Skip to content

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

davidism added 2 commits April 7, 2020 09:55
- 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 force-pushed the remove-simplejson branch from b9b0fa8 to 756902c Compare April 7, 2020 20:37
@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

3 participants