Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coercing to Unicode #97

Open
leofirespotter opened this issue Jun 1, 2019 · 0 comments
Open

Coercing to Unicode #97

leofirespotter opened this issue Jun 1, 2019 · 0 comments

Comments

@leofirespotter
Copy link

Seeing a strange bug in the library. Here is the simplest repro of it that I could find:

src = {'1' : 'def'}
dst = {'test' : '1', 'b' : 'def'}
jsonpatch.make_patch(src, dst)

Which leads produces the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "jsonpatch.py", line 164, in make_patch
    return JsonPatch.from_diff(src, dst)
  File "jsonpatch.py", line 283, in from_diff
    builder._compare_values('', None, src, dst)
  File "jsonpatch.py", line 820, in _compare_values
    self._compare_dicts(_path_join(path, key), src, dst)
  File "jsonpatch.py", line 781, in _compare_dicts
    self._item_added(path, str(key), dst[key])
  File "jsonpatch.py", line 717, in _item_added
    op.key = v._on_undo_remove(op.path, op.key)
  File "jsonpatch.py", line 445, in _on_undo_remove
    self.key += 1
TypeError: coercing to Unicode: need string or buffer, int found

Any ideas?

itkach pushed a commit to itkach/python-json-patch that referenced this issue Jun 28, 2019
stefankoegl added a commit that referenced this issue Jul 28, 2019
Fix move for numeric dictionary keys (issue #97)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant