From 41c5f562e0a6a363e71cec2d787918ca66fbb383b4b0653421b9d49891f800e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 6 Aug 2020 05:42:59 +0000 Subject: [PATCH] Accepting request 824518 from home:mcalabkova:branches:devel:languages:python - Update to 1.2.2 * Fix encoding of UTF-16 surrogate pairs * Made MANIFEST.in more explicit * Refactored setup.py to be PEP-8 compliant * Pass command line arguments from build_inplace to setup.py * Cleanup after build_inplace * Explicitly use python2 in shebang lines * Updated license - Rebase py3.patch OBS-URL: https://build.opensuse.org/request/show/824518 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-cjson?expand=0&rev=7 --- py3.patch | 72 ++++++++++++++++++------------------- python-cjson-1.2.1.tar.gz | 3 -- python-cjson-1.2.2.tar.gz | 3 ++ python-python-cjson.changes | 13 +++++++ python-python-cjson.spec | 4 +-- 5 files changed, 54 insertions(+), 41 deletions(-) delete mode 100644 python-cjson-1.2.1.tar.gz create mode 100644 python-cjson-1.2.2.tar.gz diff --git a/py3.patch b/py3.patch index 9beb985..05dff2c 100644 --- a/py3.patch +++ b/py3.patch @@ -8,10 +8,10 @@ Subject: [PATCH] Python 3 support - initial attempt jsontest.py | 16 ++-- 2 files changed, 144 insertions(+), 140 deletions(-) -diff --git a/cjson.c b/cjson.c -index d3ecc81..a44e7e4 100644 ---- a/cjson.c -+++ b/cjson.c +Index: python-cjson-1.2.2/cjson.c +=================================================================== +--- python-cjson-1.2.2.orig/cjson.c ++++ python-cjson-1.2.2/cjson.c @@ -8,6 +8,16 @@ #include #include @@ -96,11 +96,10 @@ index d3ecc81..a44e7e4 100644 Py_DECREF(str); -@@ -579,75 +594,6 @@ decode_json(JSONData *jsondata) - +@@ -580,75 +595,6 @@ decode_json(JSONData *jsondata) /* ------------------------------ Encoding ----------------------------- */ --/* + /* - * This function is an almost verbatim copy of PyString_Repr() from - * Python's stringobject.c with the following differences: - * @@ -169,9 +168,10 @@ index d3ecc81..a44e7e4 100644 - } -} - - /* +-/* * This function is an almost verbatim copy of unicodeescape_string() from * Python's unicodeobject.c with the following differences: + * @@ -662,7 +608,7 @@ encode_unicode(PyObject *unicode) PyObject *repr; Py_UNICODE *s; @@ -204,7 +204,7 @@ index d3ecc81..a44e7e4 100644 *p++ = '\\'; *p++ = (char) ch; continue; -@@ -801,10 +747,11 @@ encode_unicode(PyObject *unicode) +@@ -782,10 +728,11 @@ encode_unicode(PyObject *unicode) *p++ = (char) ch; } @@ -218,7 +218,7 @@ index d3ecc81..a44e7e4 100644 return repr; } -@@ -825,9 +772,9 @@ encode_tuple(PyObject *tuple) +@@ -806,9 +753,9 @@ encode_tuple(PyObject *tuple) PyObject *pieces, *result = NULL; PyTupleObject *v = (PyTupleObject*) tuple; @@ -230,7 +230,7 @@ index d3ecc81..a44e7e4 100644 pieces = PyTuple_New(n); if (pieces == NULL) -@@ -843,29 +790,29 @@ encode_tuple(PyObject *tuple) +@@ -824,29 +771,29 @@ encode_tuple(PyObject *tuple) /* Add "[]" decorations to the first and last items. */ assert(n > 0); @@ -266,7 +266,7 @@ index d3ecc81..a44e7e4 100644 Py_DECREF(s); Done: -@@ -899,8 +846,8 @@ encode_list(PyObject *list) +@@ -880,8 +827,8 @@ encode_list(PyObject *list) return NULL; } @@ -277,7 +277,7 @@ index d3ecc81..a44e7e4 100644 goto Done; } -@@ -910,7 +857,7 @@ encode_list(PyObject *list) +@@ -891,7 +838,7 @@ encode_list(PyObject *list) /* Do repr() on each element. Note that this may mutate the list, * so must refetch the list size on each iteration. */ @@ -286,7 +286,7 @@ index d3ecc81..a44e7e4 100644 int status; s = encode_object(v->ob_item[i]); if (s == NULL) -@@ -923,29 +870,29 @@ encode_list(PyObject *list) +@@ -904,29 +851,29 @@ encode_list(PyObject *list) /* Add "[]" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); @@ -322,7 +322,7 @@ index d3ecc81..a44e7e4 100644 Py_DECREF(s); Done: -@@ -984,7 +931,7 @@ encode_dict(PyObject *dict) +@@ -965,7 +912,7 @@ encode_dict(PyObject *dict) } if (mp->ma_used == 0) { @@ -331,7 +331,7 @@ index d3ecc81..a44e7e4 100644 goto Done; } -@@ -992,7 +939,7 @@ encode_dict(PyObject *dict) +@@ -973,7 +920,7 @@ encode_dict(PyObject *dict) if (pieces == NULL) goto Done; @@ -340,7 +340,7 @@ index d3ecc81..a44e7e4 100644 if (colon == NULL) goto Done; -@@ -1002,7 +949,7 @@ encode_dict(PyObject *dict) +@@ -983,7 +930,7 @@ encode_dict(PyObject *dict) while (PyDict_Next((PyObject *)mp, &i, &key, &value)) { int status; @@ -349,7 +349,7 @@ index d3ecc81..a44e7e4 100644 PyErr_SetString(JSON_EncodeError, "JSON encodable dictionaries " "must have string/unicode keys"); goto Done; -@@ -1010,9 +957,10 @@ encode_dict(PyObject *dict) +@@ -991,9 +938,10 @@ encode_dict(PyObject *dict) /* Prevent repr from deleting value during key format. */ Py_INCREF(value); @@ -363,7 +363,7 @@ index d3ecc81..a44e7e4 100644 Py_DECREF(value); if (s == NULL) goto Done; -@@ -1024,35 +972,36 @@ encode_dict(PyObject *dict) +@@ -1005,35 +953,36 @@ encode_dict(PyObject *dict) /* Add "{}" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); @@ -406,7 +406,7 @@ index d3ecc81..a44e7e4 100644 return result; } -@@ -1061,29 +1010,27 @@ static PyObject* +@@ -1042,29 +991,27 @@ static PyObject* encode_object(PyObject *object) { if (object == Py_True) { @@ -443,7 +443,7 @@ index d3ecc81..a44e7e4 100644 return PyObject_Str(object); } else if (PyList_Check(object)) { PyObject *result; -@@ -1130,6 +1077,7 @@ JSON_decode(PyObject *self, PyObject *args, PyObject *kwargs) +@@ -1111,6 +1058,7 @@ JSON_decode(PyObject *self, PyObject *ar static char *kwlist[] = {"json", "all_unicode", NULL}; int all_unicode = False; // by default return unicode only when needed PyObject *object, *string, *str; @@ -451,7 +451,7 @@ index d3ecc81..a44e7e4 100644 JSONData jsondata; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:decode", kwlist, -@@ -1146,13 +1094,13 @@ JSON_decode(PyObject *self, PyObject *args, PyObject *kwargs) +@@ -1127,13 +1075,13 @@ JSON_decode(PyObject *self, PyObject *ar str = string; } @@ -467,7 +467,7 @@ index d3ecc81..a44e7e4 100644 jsondata.all_unicode = all_unicode; object = decode_json(&jsondata); -@@ -1198,37 +1146,93 @@ PyDoc_STRVAR(module_doc, +@@ -1179,37 +1127,93 @@ PyDoc_STRVAR(module_doc, /* Initialization function for the module (*must* be called initcjson) */ @@ -567,11 +567,11 @@ index d3ecc81..a44e7e4 100644 } - - -diff --git a/jsontest.py b/jsontest.py -index 0f79307..19c24fa 100644 ---- a/jsontest.py -+++ b/jsontest.py -@@ -128,7 +128,7 @@ def testReadBadEscapedHexCharacter(self): +Index: python-cjson-1.2.2/jsontest.py +=================================================================== +--- python-cjson-1.2.2.orig/jsontest.py ++++ python-cjson-1.2.2/jsontest.py +@@ -128,7 +128,7 @@ class JsonTest(unittest.TestCase): self.assertRaises(_exception, self.doReadBadEscapedHexCharacter) def doReadBadEscapedHexCharacter(self): @@ -580,7 +580,7 @@ index 0f79307..19c24fa 100644 def testReadBadObjectKey(self): self.assertRaises(_exception, self.doReadBadObjectKey) -@@ -141,7 +141,7 @@ def testReadBadArray(self): +@@ -141,7 +141,7 @@ class JsonTest(unittest.TestCase): def doReadBadArray(self): cjson.decode('[1,2,3,,]') @@ -589,7 +589,7 @@ index 0f79307..19c24fa 100644 def testReadBadObjectSyntax(self): self.assertRaises(_exception, self.doReadBadObjectSyntax) -@@ -159,7 +159,7 @@ def testReadIntegerValue(self): +@@ -159,7 +159,7 @@ class JsonTest(unittest.TestCase): def testReadNegativeIntegerValue(self): obj = cjson.decode('{ "key" : -44 }') self.assertEqual({ "key" : -44 }, obj) @@ -598,7 +598,7 @@ index 0f79307..19c24fa 100644 def testReadFloatValue(self): obj = cjson.decode('{ "age" : 44.5 }') self.assertEqual({ "age" : 44.5 }, obj) -@@ -176,7 +176,7 @@ def doReadBadNumber(self): +@@ -176,7 +176,7 @@ class JsonTest(unittest.TestCase): def testReadSmallObject(self): obj = cjson.decode('{ "name" : "Patrick", "age":44} ') @@ -607,7 +607,7 @@ index 0f79307..19c24fa 100644 def testReadEmptyArray(self): obj = cjson.decode('[]') -@@ -194,7 +194,7 @@ def testWriteSmallArray(self): +@@ -194,7 +194,7 @@ class JsonTest(unittest.TestCase): def testWriteSmallObject(self): s = cjson.encode({ "name" : "Patrick", "age": 44 }) @@ -616,7 +616,7 @@ index 0f79307..19c24fa 100644 def testWriteFloat(self): n = 3.44556677 -@@ -276,7 +276,7 @@ def testWriteComplexArray(self): +@@ -276,7 +276,7 @@ class JsonTest(unittest.TestCase): obj = [{"name":"Patrick","age":44,"Employed?":True,"Female?":False,"grandchildren":None}, "used","abused","confused", 1,2,[3,4,5]] @@ -625,7 +625,7 @@ index 0f79307..19c24fa 100644 _removeWhitespace(cjson.encode(obj))) -@@ -290,7 +290,7 @@ def testReadWriteCopies(self): +@@ -290,7 +290,7 @@ class JsonTest(unittest.TestCase): def testStringEncoding(self): s = cjson.encode([1, 2, 3]) @@ -634,9 +634,9 @@ index 0f79307..19c24fa 100644 def testReadEmptyObjectAtEndOfArray(self): self.assertEqual(["a","b","c",{}], -@@ -329,7 +329,7 @@ def testWriteLongUnicode(self): +@@ -331,7 +331,7 @@ class JsonTest(unittest.TestCase): 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) - + diff --git a/python-cjson-1.2.1.tar.gz b/python-cjson-1.2.1.tar.gz deleted file mode 100644 index a6d6ddb..0000000 --- a/python-cjson-1.2.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:52db2745264624768bfd9b604acb38f631bde5c2ec9b23861677d747e4558626 -size 12575 diff --git a/python-cjson-1.2.2.tar.gz b/python-cjson-1.2.2.tar.gz new file mode 100644 index 0000000..22318a5 --- /dev/null +++ b/python-cjson-1.2.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3006c2c218297be3448dc793218e0b15d20fe9839775521bfc294fc6aa24972b +size 12603 diff --git a/python-python-cjson.changes b/python-python-cjson.changes index 668e5e9..1e6e6a6 100644 --- a/python-python-cjson.changes +++ b/python-python-cjson.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Wed Aug 5 14:50:03 UTC 2020 - Marketa Calabkova + +- Update to 1.2.2 + * Fix encoding of UTF-16 surrogate pairs + * Made MANIFEST.in more explicit + * Refactored setup.py to be PEP-8 compliant + * Pass command line arguments from build_inplace to setup.py + * Cleanup after build_inplace + * Explicitly use python2 in shebang lines + * Updated license +- Rebase py3.patch + ------------------------------------------------------------------- Thu Apr 30 07:26:40 UTC 2020 - Tomáš Chvátal diff --git a/python-python-cjson.spec b/python-python-cjson.spec index d4f55ac..4fda69e 100644 --- a/python-python-cjson.spec +++ b/python-python-cjson.spec @@ -19,10 +19,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-python-cjson -Version: 1.2.1 +Version: 1.2.2 Release: 0 Summary: C-accelerated JSON encoder/decoder for Python -License: LGPL-2.0-or-later +License: LGPL-2.1-or-later Group: Development/Languages/Python URL: https://github.com/AGProjects/python-cjson Source: https://files.pythonhosted.org/packages/source/p/python-cjson/python-cjson-%{version}.tar.gz