Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-jsonpatch for openSUSE:Factory checked in at 2021-04-26 16:38:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-jsonpatch (Old) and /work/SRC/openSUSE:Factory/.python-jsonpatch.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jsonpatch" Mon Apr 26 16:38:48 2021 rev:23 rq:887884 version:1.31 Changes: -------- --- /work/SRC/openSUSE:Factory/python-jsonpatch/python-jsonpatch.changes 2020-12-23 14:19:19.129606220 +0100 +++ /work/SRC/openSUSE:Factory/.python-jsonpatch.new.12324/python-jsonpatch.changes 2021-04-26 16:39:00.262016425 +0200 @@ -1,0 +2,7 @@ +Thu Apr 22 20:25:23 UTC 2021 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.31: + * Add support for preserving Unicode charaters + * remove pypy build + +------------------------------------------------------------------- Old: ---- jsonpatch-1.28.tar.gz New: ---- jsonpatch-1.31.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-jsonpatch.spec ++++++ --- /var/tmp/diff_new_pack.JcMw0b/_old 2021-04-26 16:39:00.822017317 +0200 +++ /var/tmp/diff_new_pack.JcMw0b/_new 2021-04-26 16:39:00.826017323 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-jsonpatch # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-jsonpatch -Version: 1.28 +Version: 1.31 Release: 0 Summary: Python - JSON-Patches License: BSD-3-Clause @@ -31,7 +31,7 @@ BuildRequires: python-rpm-macros Requires: python-jsonpointer >= 1.9 Requires(post): update-alternatives -Requires(preun): update-alternatives +Requires(preun):update-alternatives BuildArch: noarch %python_subpackages ++++++ jsonpatch-1.28.tar.gz -> jsonpatch-1.31.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.28/PKG-INFO new/jsonpatch-1.31/PKG-INFO --- old/jsonpatch-1.28/PKG-INFO 2020-12-01 20:56:56.000000000 +0100 +++ new/jsonpatch-1.31/PKG-INFO 2021-03-04 20:15:29.000000000 +0100 @@ -1,17 +1,17 @@ Metadata-Version: 1.2 Name: jsonpatch -Version: 1.28 +Version: 1.31 Summary: Apply JSON-Patches (RFC 6902) Home-page: https://github.com/stefankoegl/python-json-patch Author: Stefan K??gl Author-email: ste...@skoegl.net License: Modified BSD License Project-URL: Website, https://github.com/stefankoegl/python-json-patch -Project-URL: Tests, https://travis-ci.org/stefankoegl/python-json-patch Project-URL: Repository, https://github.com/stefankoegl/python-json-patch.git -Project-URL: Test Coverage, https://coveralls.io/r/stefankoegl/python-json-patch Project-URL: Documentation, https://python-json-patch.readthedocs.org/ Project-URL: PyPI, https://pypi.org/pypi/jsonpatch +Project-URL: Tests, https://travis-ci.org/stefankoegl/python-json-patch +Project-URL: Test Coverage, https://coveralls.io/r/stefankoegl/python-json-patch Description: python-json-patch ================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.28/bin/jsonpatch new/jsonpatch-1.31/bin/jsonpatch --- old/jsonpatch-1.28/bin/jsonpatch 2020-12-01 20:56:37.000000000 +0100 +++ new/jsonpatch-1.31/bin/jsonpatch 2021-03-04 20:15:07.000000000 +0100 @@ -24,7 +24,8 @@ help='Modify ORIGINAL in-place instead of to stdout') parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + jsonpatch.__version__) - +parser.add_argument('-u', '--preserve-unicode', action='store_true', + help='Output Unicode character as-is without using Code Point') def main(): try: @@ -72,8 +73,8 @@ # By this point we have some sort of file object we can write the # modified JSON to. - - json.dump(result, fp, indent=args.indent) + + json.dump(result, fp, indent=args.indent, ensure_ascii=not(args.preserve_unicode)) fp.write('\n') if args.in_place: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.28/jsonpatch.egg-info/PKG-INFO new/jsonpatch-1.31/jsonpatch.egg-info/PKG-INFO --- old/jsonpatch-1.28/jsonpatch.egg-info/PKG-INFO 2020-12-01 20:56:56.000000000 +0100 +++ new/jsonpatch-1.31/jsonpatch.egg-info/PKG-INFO 2021-03-04 20:15:29.000000000 +0100 @@ -1,17 +1,17 @@ Metadata-Version: 1.2 Name: jsonpatch -Version: 1.28 +Version: 1.31 Summary: Apply JSON-Patches (RFC 6902) Home-page: https://github.com/stefankoegl/python-json-patch Author: Stefan K??gl Author-email: ste...@skoegl.net License: Modified BSD License Project-URL: Website, https://github.com/stefankoegl/python-json-patch -Project-URL: Tests, https://travis-ci.org/stefankoegl/python-json-patch Project-URL: Repository, https://github.com/stefankoegl/python-json-patch.git -Project-URL: Test Coverage, https://coveralls.io/r/stefankoegl/python-json-patch Project-URL: Documentation, https://python-json-patch.readthedocs.org/ Project-URL: PyPI, https://pypi.org/pypi/jsonpatch +Project-URL: Tests, https://travis-ci.org/stefankoegl/python-json-patch +Project-URL: Test Coverage, https://coveralls.io/r/stefankoegl/python-json-patch Description: python-json-patch ================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.28/jsonpatch.py new/jsonpatch-1.31/jsonpatch.py --- old/jsonpatch-1.28/jsonpatch.py 2020-12-01 20:56:37.000000000 +0100 +++ new/jsonpatch-1.31/jsonpatch.py 2021-03-04 20:15:07.000000000 +0100 @@ -61,7 +61,7 @@ # Will be parsed by setup.py to determine package metadata __author__ = 'Stefan K??gl <ste...@skoegl.net>' -__version__ = '1.28' +__version__ = '1.31' __website__ = 'https://github.com/stefankoegl/python-json-patch' __license__ = 'Modified BSD License' @@ -635,7 +635,7 @@ True """ json_dumper = dumps or cls.json_dumper - builder = DiffBuilder(json_dumper, pointer_cls=pointer_cls) + builder = DiffBuilder(src, dst, json_dumper, pointer_cls=pointer_cls) builder._compare_values('', None, src, dst) ops = list(builder.execute()) return cls(ops, pointer_cls=pointer_cls) @@ -688,12 +688,14 @@ class DiffBuilder(object): - def __init__(self, dumps=json.dumps, pointer_cls=JsonPointer): + def __init__(self, src_doc, dst_doc, dumps=json.dumps, pointer_cls=JsonPointer): self.dumps = dumps self.pointer_cls = pointer_cls self.index_storage = [{}, {}] self.index_storage2 = [[], []] self.__root = root = [] + self.src_doc = src_doc + self.dst_doc = dst_doc root[:] = [root, root, None] def store_index(self, value, index, st): @@ -800,7 +802,12 @@ new_index = self.insert(new_op) if index is not None: op = index[2] - if type(op.key) == int: + # We can't rely on the op.key type since PatchOperation casts + # the .key property to int and this path wrongly ends up being taken + # for numeric string dict keys while the intention is to only handle lists. + # So we do an explicit check on the item affected by the op instead. + added_item = op.pointer.to_last(self.dst_doc)[0] + if type(added_item) == list: for v in self.iter_from(index): op.key = v._on_undo_add(op.path, op.key) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.28/tests.py new/jsonpatch-1.31/tests.py --- old/jsonpatch-1.28/tests.py 2020-12-01 20:56:37.000000000 +0100 +++ new/jsonpatch-1.31/tests.py 2021-03-04 20:15:07.000000000 +0100 @@ -490,6 +490,61 @@ self.assertEqual(res, dst) self.assertIsInstance(res['A'], float) + def test_issue119(self): + """Make sure it avoids casting numeric str dict key to int""" + src = [ + {'foobar': {u'1': [u'lettuce', u'cabbage', u'bok choy', u'broccoli'], u'3': [u'ibex'], u'2': [u'apple'], u'5': [], u'4': [u'gerenuk', u'duiker'], u'10_1576156603109': [], u'6': [], u'8_1572034252560': [u'thompson', u'gravie', u'mango', u'coconut'], u'7_1572034204585': []}}, + {'foobar':{u'description': u'', u'title': u''}} + ] + dst = [ + {'foobar': {u'9': [u'almond'], u'10': u'yes', u'12': u'', u'16_1598876845275': [], u'7': [u'pecan']}}, + {'foobar': {u'1': [u'lettuce', u'cabbage', u'bok choy', u'broccoli'], u'3': [u'ibex'], u'2': [u'apple'], u'5': [], u'4': [u'gerenuk', u'duiker'], u'10_1576156603109': [], u'6': [], u'8_1572034252560': [u'thompson', u'gravie', u'mango', u'coconut'], u'7_1572034204585': []}}, + {'foobar': {u'description': u'', u'title': u''}} + ] + patch = jsonpatch.make_patch(src, dst) + res = jsonpatch.apply_patch(src, patch) + self.assertEqual(res, dst) + + def test_issue120(self): + """Make sure it avoids casting numeric str dict key to int""" + src = [{'foobar': {'821b7213_b9e6_2b73_2e9c_cf1526314553': ['Open Work'], + '6e3d1297_0c5a_88f9_576b_ad9216611c94': ['Many Things'], + '1987bcf0_dc97_59a1_4c62_ce33e51651c7': ['Product']}}, + {'foobar': {'2a7624e_0166_4d75_a92c_06b3f': []}}, + {'foobar': {'10': [], + '11': ['bee', + 'ant', + 'wasp'], + '13': ['phobos', + 'titan', + 'gaea'], + '14': [], + '15': 'run3', + '16': 'service', + '2': ['zero', 'enable']}}] + dst = [{'foobar': {'1': [], '2': []}}, + {'foobar': {'821b7213_b9e6_2b73_2e9c_cf1526314553': ['Open Work'], + '6e3d1297_0c5a_88f9_576b_ad9216611c94': ['Many Things'], + '1987bcf0_dc97_59a1_4c62_ce33e51651c7': ['Product']}}, + {'foobar': {'2a7624e_0166_4d75_a92c_06b3f': []}}, + {'foobar': {'b238d74d_dcf4_448c_9794_c13a2f7b3c0a': [], + 'dcb0387c2_f7ae_b8e5bab_a2b1_94deb7c': []}}, + {'foobar': {'10': [], + '11': ['bee', + 'ant', + 'fly'], + '13': ['titan', + 'phobos', + 'gaea'], + '14': [], + '15': 'run3', + '16': 'service', + '2': ['zero', 'enable']}} + ] + patch = jsonpatch.make_patch(src, dst) + res = jsonpatch.apply_patch(src, patch) + self.assertEqual(res, dst) + def test_custom_types_diff(self): old = {'value': decimal.Decimal('1.0')} new = {'value': decimal.Decimal('1.00')}