python-cjson
Advanced tools
+17
-36
@@ -669,3 +669,3 @@ | ||
| #ifdef Py_UNICODE_WIDE | ||
| const Py_ssize_t expandsize = 10; | ||
| const Py_ssize_t expandsize = 12; | ||
| #else | ||
@@ -717,43 +717,24 @@ const Py_ssize_t expandsize = 6; | ||
| #ifdef Py_UNICODE_WIDE | ||
| /* Map 21-bit characters to '\U00xxxxxx' */ | ||
| /* Map 21-bit characters to UTF-16 surrogate pairs */ | ||
| else if (ch >= 0x10000) { | ||
| unsigned short ucs1, ucs2; | ||
| ucs1 = (unsigned short)(((ch - 0x10000) >> 10) & 0x03FF) + 0xD800; | ||
| ucs2 = (unsigned short)((ch - 0x10000) & 0x03FF) + 0xDC00; | ||
| *p++ = '\\'; | ||
| *p++ = 'U'; | ||
| *p++ = hexdigit[(ch >> 28) & 0x0000000F]; | ||
| *p++ = hexdigit[(ch >> 24) & 0x0000000F]; | ||
| *p++ = hexdigit[(ch >> 20) & 0x0000000F]; | ||
| *p++ = hexdigit[(ch >> 16) & 0x0000000F]; | ||
| *p++ = hexdigit[(ch >> 12) & 0x0000000F]; | ||
| *p++ = hexdigit[(ch >> 8) & 0x0000000F]; | ||
| *p++ = hexdigit[(ch >> 4) & 0x0000000F]; | ||
| *p++ = hexdigit[ch & 0x0000000F]; | ||
| *p++ = 'u'; | ||
| *p++ = hexdigit[(ucs1 >> 12) & 0x000F]; | ||
| *p++ = hexdigit[(ucs1 >> 8) & 0x000F]; | ||
| *p++ = hexdigit[(ucs1 >> 4) & 0x000F]; | ||
| *p++ = hexdigit[ucs1 & 0x000F]; | ||
| *p++ = '\\'; | ||
| *p++ = 'u'; | ||
| *p++ = hexdigit[(ucs2 >> 12) & 0x000F]; | ||
| *p++ = hexdigit[(ucs2 >> 8) & 0x000F]; | ||
| *p++ = hexdigit[(ucs2 >> 4) & 0x000F]; | ||
| *p++ = hexdigit[ucs2 & 0x000F]; | ||
| continue; | ||
| } | ||
| #endif | ||
| /* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */ | ||
| else if (ch >= 0xD800 && ch < 0xDC00) { | ||
| Py_UNICODE ch2; | ||
| Py_UCS4 ucs; | ||
| ch2 = *s++; | ||
| size--; | ||
| if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { | ||
| ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; | ||
| *p++ = '\\'; | ||
| *p++ = 'U'; | ||
| *p++ = hexdigit[(ucs >> 28) & 0x0000000F]; | ||
| *p++ = hexdigit[(ucs >> 24) & 0x0000000F]; | ||
| *p++ = hexdigit[(ucs >> 20) & 0x0000000F]; | ||
| *p++ = hexdigit[(ucs >> 16) & 0x0000000F]; | ||
| *p++ = hexdigit[(ucs >> 12) & 0x0000000F]; | ||
| *p++ = hexdigit[(ucs >> 8) & 0x0000000F]; | ||
| *p++ = hexdigit[(ucs >> 4) & 0x0000000F]; | ||
| *p++ = hexdigit[ucs & 0x0000000F]; | ||
| continue; | ||
| } | ||
| /* Fall through: isolated surrogates are copied as-is */ | ||
| s--; | ||
| size++; | ||
| } | ||
| /* Map 16-bit characters to '\uxxxx' */ | ||
@@ -760,0 +741,0 @@ if (ch >= 256) { |
+4
-2
@@ -1,2 +0,2 @@ | ||
| #!/usr/bin/python | ||
| #!/usr/bin/python2 | ||
@@ -328,5 +328,7 @@ ## this test suite is an almost verbatim copy of the jsontest.py test suite | ||
| # undetected. | ||
| # In any case, in ECMA-404, only utf-16 surrogate pairs are | ||
| # valid, so \U0001D11E should be encoded as \ud834\udd1e | ||
| s = cjson.encode(u'\U0001D11E\U0001D11E\U0001D11E\U0001D11E' | ||
| u'\u1234\u1234\u1234\u1234\u1234\u1234') | ||
| self.assertEqual(r'"\U0001d11e\U0001d11e\U0001d11e\U0001d11e' | ||
| self.assertEqual(r'"\ud834\udd1e\ud834\udd1e\ud834\udd1e\ud834\udd1e' | ||
| r'\u1234\u1234\u1234\u1234\u1234\u1234"', s) | ||
@@ -333,0 +335,0 @@ |
+11
-14
@@ -0,18 +1,15 @@ | ||
| Copyright 2006-2020 Dan Pascu | ||
| Copyright (C) 2006-2017 | ||
| Dan Pascu | ||
| License: LGPL-2.1+ | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2 of the License, or (at your option) any later version. | ||
| This program is free software; you can redistribute it and/or modify it | ||
| under the terms of the GNU Lesser General Public License as published | ||
| by the Free Software Foundation; either version 2.1 of the License, or | ||
| (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public License | ||
| along with this library; if not, write to the Free Software Foundation, | ||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| For a copy of the license see https://www.gnu.org/licenses/lgpl-2.1.html |
+7
-1
@@ -1,1 +0,7 @@ | ||
| include LICENSE ChangeLog MANIFEST.in build_inplace jsontest.py | ||
| include ChangeLog | ||
| include LICENSE | ||
| include README | ||
| include MANIFEST.in | ||
| include build_inplace | ||
| include jsontest.py |
+1
-1
| Metadata-Version: 1.1 | ||
| Name: python-cjson | ||
| Version: 1.2.1 | ||
| Version: 1.2.2 | ||
| Summary: Fast JSON encoder/decoder for Python | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/AGProjects/python-cjson |
+26
-21
@@ -1,29 +0,34 @@ | ||
| #!/usr/bin/python | ||
| #!/usr/bin/python2 | ||
| from distutils.core import setup, Extension | ||
| __version__ = "1.2.1" | ||
| __version__ = '1.2.2' | ||
| macros = [('MODULE_VERSION', __version__)] | ||
| setup(name = "python-cjson", | ||
| version = __version__, | ||
| author = "Dan Pascu", | ||
| author_email = "dan@ag-projects.com", | ||
| url = "https://github.com/AGProjects/python-cjson", | ||
| description = "Fast JSON encoder/decoder for Python", | ||
| long_description = open('README').read(), | ||
| license = "LGPL", | ||
| platforms = ["Platform Independent"], | ||
| classifiers = [ | ||
| "Development Status :: 5 - Production/Stable", | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python", | ||
| "Topic :: Software Development :: Libraries :: Python Modules" | ||
| ], | ||
| ext_modules = [ | ||
| setup( | ||
| name='python-cjson', | ||
| version=__version__, | ||
| description='Fast JSON encoder/decoder for Python', | ||
| long_description=open('README').read(), | ||
| url='https://github.com/AGProjects/python-cjson', | ||
| license='LGPL', | ||
| author='Dan Pascu', | ||
| author_email='dan@ag-projects.com', | ||
| platforms=['Platform Independent'], | ||
| classifiers=[ | ||
| 'Development Status :: 5 - Production/Stable', | ||
| 'Intended Audience :: Developers', | ||
| 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', | ||
| 'Operating System :: OS Independent', | ||
| 'Programming Language :: Python', | ||
| 'Topic :: Software Development :: Libraries :: Python Modules' | ||
| ], | ||
| ext_modules=[ | ||
| Extension(name='cjson', sources=['cjson.c'], define_macros=macros) | ||
| ] | ||
| ] | ||
| ) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
288
1.05%52255
-0.79%