1
0
Fork 0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-05-27 17:16:18 +02:00
Commit Graph

99 Commits

Author SHA1 Message Date
Hugo van Kemenade f2d79b89c4 Remove unused variable 2021-04-07 10:23:26 +03:00
Filip Salomonsson 7a8a614017
Fix typos in error message 2021-02-03 17:32:42 +01:00
David W.H. Swenson 6013e71381
Merge remote-tracking branch 'upstream/master' into fix_large_floats 2020-11-15 19:56:19 +01:00
Hugo van Kemenade 13e2ac7eea
Merge pull request #443 from dwhswenson/match_python_exponents 2020-11-15 19:25:37 +02:00
David W.H. Swenson 954a9a0a00
cleanup 2020-11-11 16:54:57 +01:00
David W.H. Swenson a48f8b22f1
Set same bounds as std lib for negative exponent 2020-11-11 16:41:34 +01:00
David W.H. Swenson b773bf05dc
Fix errors on reading long decimal floats 2020-11-11 14:51:27 +01:00
David W.H. Swenson af699c3cd0
Match Python json output for exponents 2020-11-11 14:41:51 +01:00
Sam Sneddon f4029cc6ef Fix #429: Make empty dict/list indented serialization match stdlib json
Previously, we'd output a couple of new lines between the start and end
of the object, whereas the stdlib doesn't bother with whitespace if
they're empty.

In my testing, the only difference in indented serialization now is
float representation.
2020-11-10 10:57:15 +00:00
Hugo 4ae63bee5c Lint end-of-file-fixer 2020-05-12 09:36:47 +03:00
Hugo 5f1e8479fa Lint trailing-whitespace 2020-05-12 09:21:45 +03:00
Eric Le Lay e0c113e6a2 Merge branch 'master' into 264-reject_bytes 2020-05-08 17:34:35 +02:00
Hugo van Kemenade f953a0978a
Update comment 2020-05-04 09:23:39 +03:00
Hugo van Kemenade d9ca1c9b5b
Merge branch 'master' into add_nan_support 2020-03-27 21:41:33 +02:00
Hugo 61453ad7fd Fix typo 2020-03-08 00:17:27 +02:00
Hugo c810a5b8a6 Also define LIKELY/UNLIKELY for _WIN32 2020-03-08 00:17:27 +02:00
Hugo 75695ba61e Indent ifdefs 2020-03-08 00:17:27 +02:00
Natanael Copa 0f52df8f9b Reduce default buffer on stack size
Fix segfaults on musl libc when ultrajson runs in a thread. On musl libc
the default thread stack size is only 80k so allocating a 128k buffer on
stack will guarantee a crash. There seems not to be any evident
performance benefit using big buffer on stack either so we just reduce
the default.

fixes #254
2020-03-02 23:45:56 +02:00
Hugo f0b428ea37 Merge branch 'master' into 50-object-trailing-comma 2020-03-01 23:54:09 +02:00
Eric Le Lay b69b37f6d0
fix typo in doc (2)
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-03-01 15:53:43 +01:00
Hugo van Kemenade 631850788d
Merge branch 'master' into add_nan_support 2020-02-25 22:34:37 +02:00
Hugo van Kemenade 1588690257
Merge branch 'master' into 264-reject_bytes 2020-02-25 22:28:14 +02:00
Hugo d53480c332 http -> https 2020-02-18 21:57:13 +02:00
Mark Guzman fe0e88d345
adding an allow_nan keyword argument to dumps defaulted to True
with this ujson matches the builtin json behavior for NaN and Inf.
if a user wants to retain the old behavior they can pass allow_nan=False
to ensure strict json compatibility.
2019-02-20 09:50:05 -05:00
Tim Dawborn 948807cfe5
Correct JSON decoding implementation to die on trailing commas in Objects. Fixes esnme/ultrajson#50. 2018-12-10 18:01:40 +11:00
Eric Le Lay ad280fd99e new reject_bytes option to raise on bytes
raise TypeError when encountering bytes in ujson.dumps() to prevent
unexpected Unicode exceptions in production.
Fixes #264
2017-06-11 11:58:10 +02:00
markpiekarz 629128de5e Update ultrajsondec.c
Explicitly include stdint.h to define SIZE_MAX.
2017-03-29 17:02:31 +11:00
Joakim Hamren eb7d894f22 Integrated google's double-conversion lib
To fix issues with floating-point precision we've made use of Google's
double-conversion lib to handle conversions of doubles to and from strings.

In addition to fixing our precision problems this will improve double
encoding by 4-5x. Decoding is however slightly slower according to the
benchmarks - but accurate at least.

This change removes the double_precision encoding option and the
precise_float decoding option.
2017-02-14 12:20:04 +01:00
Joakim Hamren ac4637fbc4 Following std json handling of None dict key
Previously a None dict item key would be outputted in JSON as "None".
To better align with the standard json module this was changed to output
"null". There's no proper representation of null object keys in JSON so
this is implementation specific but it seems more natural to follow
suit when it can be done without a significant performance hit.

Added and used branch prediction macros (LIKELY/UNLIKELY) as well.
2017-02-04 16:36:14 +01:00
Joakim Hamren 870ee48fe1 Fixes for sort_keys bug and a typo.
- Fixed segfault when using sort_keys=True on dict with unorderable keys (GH247)

    - Fixed refcount becoming negative when using sort_keys=True (GH243)

    - Fixed compile error when defining JSON_NO_EXTRA_WHITESPACE
      caused by a wrongly named variable. (GH245)
2017-02-04 01:07:52 +01:00
Joakim Hamrén ab6b6f88cd Merge pull request #217 from orivej/indent-dict-values
Indent dict values
2016-10-10 22:25:22 +02:00
Joakim Hamrén d25e024f48 Merge pull request #238 from WGH-/static-functions
added "static" to C functions, where possible
2016-10-10 22:06:20 +02:00
Joakim Hamren 6a0d07a7df Indentation fixes and other style fixes 2016-10-10 21:50:57 +02:00
WGH 6cf6c7ff25 added "static" to C functions, where possible
1. It reduces clutter in symbol table.
2. It fixes issues with C99 inline semantics for functions
   marked as inline (#237, #180, #222), which manifests
   when compiled with GCC>=5.
2016-08-27 17:34:22 +03:00
Orivej Desh 11b0d2db25 Indent dict values 2016-04-03 16:30:43 +00:00
Joakim Hamren 01cb24910e Merge branch 'correct_unit_tests_and_benchmarks' of https://github.com/timdawborn/ultrajson into timdawborn-correct_unit_tests_and_benchmarks
Conflicts:
	tests/tests.py
2016-01-18 06:20:14 +01:00
Joakim Hamrén 86bb8ffd10 Merge pull request #157 from wlanslovenija/raw-json
If an object has a __json__ method, use it when encoding
2016-01-15 05:06:19 +01:00
Joakim Hamrén 06fe4c68f0 Merge pull request #186 from shashurup/master
escape_forward_slashes now only ignores forward slashes, not everythi…
2016-01-15 03:50:42 +01:00
Tim Dawborn 04428508d6 * Refactored the unit testing and benchmarking code to work natively under
both Python 2 and Python 3, removing the need for 2to3 to be run. This
  indirectly fixes #177.
* Corrected a duplicate-named method in the unit testing code. Corrected the
  now-exposed broken logic that wasn't being tested. This was
  highlighted in #186 but the author did not appear to realise that the
  method name was being masked in the unit test class.
* Corrected the test case skipping logic to use unittest.skipIf instead
  of just returning from the method upon an ImportError so that the skip
  can actually be registered as a skipped test instead of a passed test.
* Updated the tests to additionally run on Python 3.5 on Travis. This
  covers #195.
* Merged the two benchmarking files into one, and modularised the code.
  Also added native RST output so the benchmarking results can be placed
  directly into the README file.
2015-12-29 14:23:23 +11:00
Joakim Hamren 0c52200eb4 Removed a left-over from conflict resolution. 2015-11-30 11:58:32 +01:00
Georgy Kibardin 457cda771d escape_forward_slashes now only ignores forward slashes, not everything else 2015-09-08 15:54:13 +03:00
Chris Huang 930dfa5525 Support for space indent for JSON encoding 2015-04-09 12:30:46 +02:00
Tim Dawborn 921716a3b7 Initial support for sort_keys parameter for JSON encoding. 2015-04-08 20:42:56 +02:00
Mathieu Leplatre d169b7ccbc Add option to disable forward slash escape
Ref issue #144
2015-03-31 23:41:51 +02:00
Mitar a8f0f0f101 If an object has a __json__ method, use it when encoding.
It should return a raw JSON string which will be directly included in
the resulting JSON when encoding.
2014-12-29 10:13:46 +01:00
Joakim Hamrén c9744834ab Merge pull request #142 from kevinbirch/support_unsigned_long_numerics
Support values between [0, 2^64 - 1]
2014-11-14 00:33:20 +01:00
kevin birch cbd68782c8 add encoding support for unsigned long long 2014-11-11 18:25:27 -05:00
Jonas Tärnström 0a2933f74f Merge pull request #148 from Jahaja/fix
Fix to avoid a crash on bounds-check fail
2014-10-29 11:18:27 +01:00
Joakim Hamren 7d28dc09ec Fixed segfault on invalid unicode char on python 3 2014-10-28 23:32:14 +01:00
Joakim Hamren 1af8acdd10 Fix to avoid a crash on bounds-check fail 2014-10-28 23:30:00 +01:00