Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork16.7k
Remove simplejson and deprecate encoding options#3562
Merged
Conversation
- remove encoding detection backport, json.loads supports it directly- use str.translate instead of multiple str.replace
make consistent with built-in json module
anmol-dhingra commentedJul 22, 2020
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
htmlsafe_dumpsto usestr.translateinstead of multiplestr.replace.encodingis passed todumps,dump,loads, orload. 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.loadsaccepts bytes andjson.loadsaccepts binary files in these encodings without any special handling on our part.dumpscan be encoded after calling, anddumpcan be passed a binary file wrapped withio.TextIOWrapper.Markupto be from MarkupSafe instead of Flask or Jinja.See the individual commits for easier diffs.
closes#3555