summaryrefslogtreecommitdiffstats
path: root/Modules/_json.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-37587: optimize json.loads (GH-15134)Inada Naoki2019-08-081-20/+19
| | | | | | | Use a tighter scope temporary variable to help register allocation. 1% speedup for large string. Use PyDict_SetItemDefault() for memoizing keys. At most 4% speedup when the cache hit ratio is low.
* bpo-37587: Make json.loads faster for long strings (GH-14752)Marco Paolini2019-07-301-1/+1
| | | | | | | | | | When scanning the string, most characters are valid, so checking for invalid characters first means never needing to check the value of strict on valid strings, and only needing to check it on invalid characters when doing non-strict parsing of invalid strings. This provides a measurable reduction in per-character processing time (~11% in the pre-merge patch testing).
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-6/+6
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-4/+4
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36793: Remove unneeded __str__ definitions. (GH-13081)Serhiy Storchaka2019-05-061-2/+2
| | | | Classes that define __str__ the same as __repr__ can just inherit it from object.
* bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853)Victor Stinner2019-04-171-5/+8
| | | | | | | | | | | | | | | | | | | | Change PyAPI_FUNC(type), PyAPI_DATA(type) and PyMODINIT_FUNC macros of pyport.h when Py_BUILD_CORE_MODULE is defined. The Py_BUILD_CORE_MODULE define must be now be used to build a C extension as a dynamic library accessing Python internals: export the PyInit_xxx() function in DLL exports on Windows. Changes: * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE now imply Py_BUILD_CORE directy in pyport.h. * ceval.c compilation now fails with an error if Py_BUILD_CORE is not defined, just to ensure that Python is build with the correct defines. * setup.py now compiles _pickle.c with Py_BUILD_CORE_MODULE define. * setup.py compiles _json.c with Py_BUILD_CORE_MODULE define, rather than Py_BUILD_CORE_BUILTIN define * PCbuild/pythoncore.vcxproj: Add Py_BUILD_CORE_BUILTIN define.
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-1/+4
|
* bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)Victor Stinner2018-11-011-1/+1
| | | | | | | The accu.h header is no longer part of the Python C API: it has been moved to the "internal" headers which are restricted to Python itself. Replace #include "accu.h" with #include "pycore_accu.h".
* bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)Alexey Izbyshev2018-09-121-3/+3
| | | Reported by Svace static analyzer.
* bpo-24641: Improved error message for JSON unserializible keys. (#4364)Serhiy Storchaka2017-11-251-2/+3
| | | | | Also updated an example for default() in the module docstring. Removed quotes around type name in other error messages.
* bpo-31505: Fix an assertion failure in json, in case _json.make_encoder() ↵Oren Milman2017-09-241-3/+13
| | | | received a bad encoder() argument. (#3643)
* bpo-30860: Move windows.h include out of internal/*.h. (#3458)Eric Snow2017-09-121-1/+1
| | | PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+7
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31095: fix potential crash during GC (GH-2974)INADA Naoki2017-08-241-2/+4
|
* bpo-30936: Fix a reference leak in json when fail to sort keys. (#2712)Serhiy Storchaka2017-07-161-1/+3
|
* bpo-30911: Fix a crash in json on platforms with unsigned char (#2684)Segev Finer2017-07-131-1/+1
| | | when pass bad strict argument.
* bpo-30248: Convert boolean arguments only once in _json. (#1423)Serhiy Storchaka2017-05-281-40/+24
| | | | | Rather than saving the Python object and calling PyObject_IsTrue() every time when the boolean argument is used, call it only once and save C boolean value.
* bpo-30243: Fixed the possibility of a crash in _json. (#1420)Serhiy Storchaka2017-05-051-66/+20
| | | | | | It was possible to get a core dump by using uninitialized _json objects. Now __new__ methods create initialized objects. __init__ methods are removed.
* bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ↵Serhiy Storchaka2017-03-211-1/+1
| | | | (#748)
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-6/+3
| | | | possible but Coccinelle couldn't find opportunity.
* Py_SIZE() was misused for dict.Serhiy Storchaka2017-01-131-1/+1
|\
| * Py_SIZE() was misused for dict.Serhiy Storchaka2017-01-131-1/+1
| |\
| | * Py_SIZE() was misused for dict.Serhiy Storchaka2017-01-131-1/+1
| | |
* | | Fixed possible reference leaks in the _json module.Serhiy Storchaka2017-01-031-4/+9
|\ \ \ | |/ /
| * | Fixed possible reference leaks in the _json module.Serhiy Storchaka2017-01-031-4/+9
| |\ \ | | |/
| | * Fixed possible reference leaks in the _json module.Serhiy Storchaka2017-01-031-4/+9
| | |
* | | Don't parenthesis in _PyObject_CallMethodId() formatVictor Stinner2016-12-081-1/+1
| | | | | | | | | | | | | | | Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation a temporary tuple, and so is more efficient.
* | | Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-6/+6
| | | | | | | | | | | | | | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* | | Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-6/+6
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
* | Issue #26719: More efficient formatting of ints and floats in json.Serhiy Storchaka2016-04-101-52/+4
|\ \ | |/
| * Issue #26719: More efficient formatting of ints and floats in json.Serhiy Storchaka2016-04-101-52/+4
| |
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-2/+2
|/ | | | private functions.
* Issue #24683: Fixed crashes in _json functions called with arguments ofSerhiy Storchaka2015-07-261-2/+10
|\ | | | | | | inappropriate type.
| * Issue #24683: Fixed crashes in _json functions called with arguments ofSerhiy Storchaka2015-07-261-2/+10
| | | | | | | | inappropriate type.
* | prevent integer overflow in escape_unicode (closes #24522)Benjamin Peterson2015-06-271-3/+9
| |
* | Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),Serhiy Storchaka2015-05-301-7/+17
|\ \ | |/ | | | | | | PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
| * Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),Serhiy Storchaka2015-05-301-7/+17
| | | | | | | | | | PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
* | merge 3.4 (#24094)Benjamin Peterson2015-05-031-28/+3
|\ \ | |/
| * merge 3.3 (#24094)Benjamin Peterson2015-05-031-28/+3
| |\
| | * just sort the items tuple directly (closes #24094)Benjamin Peterson2015-05-031-27/+3
| | |
* | | Issue #23685: Fix usage of PyMODINIT_FUNC in _json, _scproxy, nis, pyexpatVictor Stinner2015-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | _codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw modules. pyexpat.c doesn't need to redeclare PyMODINIT_FUNC, it's already declared in Include/pyport.h.
* | | Issue #22883: Got rid of outdated references to PyInt and PyString in comments.Serhiy Storchaka2015-02-171-4/+4
| | |
* | | merge 3.4 (#23369)Benjamin Peterson2015-02-011-4/+11
|\ \ \ | |/ /
| * | merge 3.3 (#23369)Benjamin Peterson2015-02-011-4/+11
| |\ \ | | |/
| | * fix possible overflow in encode_basestring_ascii (closes #23369)Benjamin Peterson2015-02-011-4/+11
| | |
* | | Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError.Serhiy Storchaka2015-01-261-11/+10
| | |
* | | Issue #23206: Make ``json.dumps(..., ensure_ascii=False)`` as fast as the ↵Antoine Pitrou2015-01-111-3/+130
|/ / | | | | | | default case of ``ensure_ascii=True``. Patch by Naoki Inada.
* | Issue #22338: Fix a crash in the json module on memory allocation failure.Victor Stinner2014-09-101-1/+2
| |
* | merge 3.3Benjamin Peterson2014-04-141-4/+5
|\ \ | |/
| * merge 3.2Benjamin Peterson2014-04-141-4/+5
| |\