Skip to content

take_index causing 'move' of incorrect values due to bad True==1 comparison #129

@Penguin2600

Description

@Penguin2600

See test here that reproduces the issue in code:
https://gist.github.com/Penguin2600/bca88971424a13f45d3560acf0e60f45

Or simply look at this REPL output to understand the impact:
Taken from line 714 of jsonpatch.py:

(Pdb) self.index_storage[st].keys()  
dict_keys([0.0, 1.0, 10.7, 'yes'])
(Pdb) stored = self.index_storage[st].get(True) 
(Pdb) len(stored)
1

In plain English, if my source data has a 1 or 1.0 anywhere and my destination data has a True anywhere jsonpatch will want to move 1.0 into the JSON where a true should be. This causes validation failures and in general incorrect output as in JSON '1.0' and 'true' are not the same thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions