summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Library/2019-07-13-16-02-48.bpo-37587.fd-1aF.rst1
-rw-r--r--Modules/_json.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-07-13-16-02-48.bpo-37587.fd-1aF.rst b/Misc/NEWS.d/next/Library/2019-07-13-16-02-48.bpo-37587.fd-1aF.rst
new file mode 100644
index 0000000..80a89fe
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-07-13-16-02-48.bpo-37587.fd-1aF.rst
@@ -0,0 +1 @@
+Make json.loads faster for long strings. (Patch by Marco Paolini)
diff --git a/Modules/_json.c b/Modules/_json.c
index 38beb6f..76da1d3 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -439,7 +439,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next
if (c == '"' || c == '\\') {
break;
}
- else if (strict && c <= 0x1f) {
+ else if (c <= 0x1f && strict) {
raise_errmsg("Invalid control character at", pystr, next);
goto bail;
}