summaryrefslogtreecommitdiff
path: root/simplejson/_speedups.c
Commit message (Collapse)AuthorAgeFilesLines
* Additional security hardening improvements:Bob Ippolito2023-04-051-7/+11
| | | | | | | | * Remove unused namedtuple_as_object and tuple_as_array arguments from simplejson.load (SJ-PT-23-102) * Remove vestigial _one_shot code from iterencode (SJ-PT-23-103) * Change default of allow_nan from True to False and add allow_nan to decoder (SJ-PT-23-107)
* SJ-PT-23-100: Fix inconsistencies in error messages between C and Python ↵Bob Ippolito2023-04-041-4/+4
| | | | implementations
* SJ-PT-23-02: Fix missing reference count decreaseBob Ippolito2023-04-041-1/+3
|
* Revert unnecessary changeBob Ippolito2022-11-141-1/+2
|
* Rename variable for clarityBob Ippolito2022-11-141-5/+5
|
* Implement speedups for #301Bob Ippolito2022-11-141-62/+68
|
* Raise TypeError when _asdict() is callable but does not return a dictBob Ippolito2021-08-231-0/+5
|
* Move the PyDict_Check after the _asdict call.Gregory P. Smith [Google LLC]2021-08-201-6/+6
| | | | Add a unittest.
* Fix the C extension module to harden is_namedtuple.Gregory P. Smith [Google LLC]2021-07-161-0/+6
| | | | | | | Protects against looks-a-likes such as Mocks. Also prevent dict encoding from causing an unraised SystemError when encountering a non-Dict. Noticed by running user tests against a CPython interpreter with C asserts enabled (COPTS += -UNDEBUG).
* fix indentationBenjamin Peterson2018-06-261-1/+1
|
* On Python 2, decode empty strings as str not unicode.Benjamin Peterson2018-06-261-7/+8
| | | | | | | | | | | | | | | | In general on Python 2, simplejson decodes ASCII strings as str, only promoting to unicode when needed: >>> simplejson.loads('["Spaetzle", "Spätzle"]') ['Spaetzle', u'Sp\xe4tzle'] Since 83a493db6a8b859ec7b10fa85365dd3fdf144c68, though, simplejson has always decoded empty JSON strings as unicode: >>> simplejson.loads('""') u'' This PR restores the old behavior of decoding empty strings as str.
* Clean up the C code.Serhiy Storchaka2018-04-251-141/+105
| | | | | | | | | * Define less version-specific macros. * Remove redundant version checks and code inside version-specific code. * Always check `PyUnicode_READY()` for external unicode objects. * Use `PyUnicode_Join()`. * Use `PyUnicode_FromOrdinal()`. * All Python string constants are now allocated only once.
* Allow to disable serializing bytes by default in Python 3.bytes-encodingSerhiy Storchaka2018-04-251-9/+20
| | | | | If encoding is None, then bytes objects will be passed to the default() method instead of transforming into unicode.
* Defer is_raw_json testRichard van der Hoff2018-04-031-6/+6
| | | | | | Instances of RawJSON are unusual; by moving the test for them to lower in encoder_listencode_obj, we get a 12% performance improvement in my tests by not doing the instanceof test.
* maybe fix windows 2.x buildBob Ippolito2017-11-241-1/+2
|
* Fix a compile error on 2.x. Closes #193.speedups-compile-error-2.7Serhiy Storchaka2017-11-241-1/+1
|
* Merge pull request #191 from simplejson/type-error-messagesBob Ippolito2017-11-231-1/+3
|\ | | | | Make TypeError messages contain type name instead of a repr.
| * Make TypeError messages contain type name instead of a repr.Serhiy Storchaka2017-11-101-1/+3
| | | | | | | | | | | | The failure depends on the type, not on the value of an object. This combines CPython's issues 26623 and 24641.
* | Merge pull request #188 from simplejson/bpo-31505Bob Ippolito2017-11-201-3/+18
|\ \ | |/ |/| bpo-31505: Fix an assertion failure in json, in case _json.make_encoder() received a bad encoder() argument.
| * bpo-31505: Fix an assertion failure in json, in case _json.make_encoder() ↵Serhiy Storchaka2017-11-061-3/+18
| | | | | | | | | | | | received a bad encoder() argument. Original patch by Oren Milman.
* | bpo-31095: fix potential crash during GC (#187)Serhiy Storchaka2017-11-061-2/+4
| | | | | | Original patch by INADA Naoki.
* | Fix a reference leak when sort keys. (#186)Serhiy Storchaka2017-11-061-2/+5
|/
* Fix #184 threaded import issue, prep v3.12.0v3.12.0Bob Ippolito2017-11-051-21/+21
|
* Fix #173 with item_sort_key and add auto-discovery to test suiteBob Ippolito2017-06-191-11/+11
|
* Merge pull request #170 from simplejson/strict-to-boolBob Ippolito2017-06-081-24/+14
|\ | | | | Call PyObject_IsTrue() only once for the strict argument of scanner.
| * Call PyObject_IsTrue() only once for the strict argument of scanner.strict-to-boolSerhiy Storchaka2017-05-211-24/+14
| |
* | Fix a crash wish unencodable encoding in the encoder.unencodable-encoder-encodingSerhiy Storchaka2017-05-211-1/+6
|/ | | | | JSONEncoder.encode() crashed in Python 3 when encoded bytes keys if the encoding was not encodable to utf-8 (contained surrogates).
* Added missed ";" in Python 2 only code.Serhiy Storchaka2017-05-211-1/+1
|
* Merge pull request #168 from simplejson/no-py2.4Bob Ippolito2017-05-201-13/+0
|\ | | | | Remove remnants of Python 2.4 support.
| * Remofe remnants of Python 2.4 support.no-py2.4Serhiy Storchaka2017-05-081-13/+0
| | | | | | | | Clean up the code by removing workarounds for supporting Python 2.4.
* | Fix argument checking errors in _speedups.c.Serhiy Storchaka2017-05-121-34/+69
| | | | | | | | | | | | | | Always check PyObject_IsTrue() for error. Also fix integer overflow in the int_as_string_bitcount argument. Fixes #167.
* | Don't set tp_new to PyType_GenericNew.remove-init-methodsSerhiy Storchaka2017-05-081-2/+0
| |
* | Remove the `__init__` methods in extension classes.Serhiy Storchaka2017-05-071-76/+31
|/ | | | | | | Calling the `__init__` methods repeatedly causes memory leaks. Not calling the `__init__` methods causes a core dump. Fixes #165. Ported from https://bugs.python.org/issue30243.
* Add support for preprocessed JSON strings (with optimizations) in encoderKevin LaFlamme2016-09-011-0/+22
| | | | In some situations, you may have a large python dictionary you need to JSONify but one of the values inside the dict is already a JSON string. This is common when pulling an object from a database, for example, where one of the fields is a JSON blob/string. Previously you would have to deserialize and then reserialize that string just to serialize the high level object, but obviously this is unnecessarily slow. This changes adds a method/type that can be used to wrap a str and tell the serializer to just pass it through instead.
* v3.8.2 - fix compiler warning, automated wheel builds for Windows and Macv3.8.2wheelsBob Ippolito2016-02-151-1/+1
|
* removed from _speedups.c forgotten "iterable_as_array" without comma after ↵Costy Petrisor2015-09-031-1/+0
| | | | string
* clean up iterable_as_array for 3.8.0v3.8.0Bob Ippolito2015-07-181-1/+2
|
* Merge branch 'master' into iterable_as_array-gh1Nick Babcock2015-07-101-502/+1205
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: CHANGES.txt conf.py index.rst setup.py simplejson/__init__.py simplejson/_speedups.c simplejson/encoder.py simplejson/tests/test_tuple.py
| * Fix msvc error C2275: 'PyObject' : illegal use of this type as an expressionChristoph Gohlke2015-05-181-2/+4
| |
| * no longer trust custom repr for int/long/float subclasses #118v3.7.0Bob Ippolito2015-05-181-4/+43
| |
| * Fix memory leak when an error occurs encoding dict itemsKeith Bussell2014-10-231-0/+1
| |
| * Fix lower bound checking in scan_once / raw_decode API #98v3.5.3Bob Ippolito2014-06-241-2/+2
| |
| * fix build for VS 2008Gabi Davar2014-05-231-1/+1
| |
| * detabv3.5.0Bob Ippolito2014-05-211-101/+101
| |
| * clean up #96 and prep for v3.5.0 releaseBob Ippolito2014-05-211-19/+22
| |
| * Merge pull request #96 from coldeasy/int_as_string_bitcountBob Ippolito2014-05-201-36/+74
| |\ | | | | | | Adding `int_as_string_bitcount` option
| | * Allocate int_as_string bounds once per encoderColin Deasy2014-05-201-31/+36
| | |
| | * Adding `int_as_string_bitcount` optionColin Deasy2014-05-141-22/+55
| | |
| * | fix arg check for item_sort_keyBob Ippolito2014-05-201-1/+3
| |/
| * pass-through in decoder for lone surrogates #62v3.3.0surrogate-62baserock/morphBob Ippolito2013-05-071-57/+41
| |