Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove simplejson and deprecate encoding options #3562

Merged
merged 3 commits into from
Apr 7, 2020
Merged

Conversation

davidism
Copy link
Member

@davidism davidism commented Apr 7, 2020

  • Remove simplejson. Remove UTF encoding guessing, which the built-in module handles now. Simplify htmlsafe_dumps to use str.translate instead of multiple str.replace.
  • Issue deprecation warning if encoding is passed to dumps, dump, loads, or load. This was deprecated in the built-in module back in 3.1. The only valid encodings for JSON are UTF-8 (with/without BOM), UTF-16 (BE/LE), and UTF-32 (BE/LE). json.loads accepts bytes and json.loads accepts binary files in these encodings without any special handling on our part. dumps can be encoded after calling, and dump can be passed a binary file wrapped with io.TextIOWrapper.
  • Rewrite docs for consistency.
  • Fix imports and references of Markup to be from MarkupSafe instead of Flask or Jinja.

See the individual commits for easier diffs.

closes #3555

- remove encoding detection backport, json.loads supports it directly
- use str.translate instead of multiple str.replace
make consistent with built-in json module
@davidism davidism added the json label Apr 7, 2020
@davidism davidism added this to the 2.0.0 milestone Apr 7, 2020
@davidism davidism merged commit e69b49b into master Apr 7, 2020
@davidism davidism deleted the remove-simplejson branch April 7, 2020 20:40
@anmol-dhingra
Copy link

@davidism I see we are no-longer importing json from itsdangerous library. When is the fix for removal of simplejson planned to be released as flask import is failing because of the simplejson raising an error.

@pallets pallets locked as resolved and limited conversation to collaborators Oct 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove simplejson
2 participants