Closed mut3 closed 1 year ago
Thanks for reporting this. Your comment about never adding nodes with discard seems very reasonable. I'll have a look!
Sorry for the very late action on this. Fix will be released in v0.20.0.
Sorry for the very late action on this. Fix will be released in v0.20.0.
No problem, thank you for the fix!
https://github.com/tobgu/pyrsistent/commit/30f138142923669c9da327abe214986919d52a07 changed the way transforms work so that they add intervening nodes from the matcher which didn't previously exist.
This addressed the case in https://github.com/tobgu/pyrsistent/issues/154 and made
Have the intuitive result:
Rather than
But I think this added an unintuitive side-effect to discard where it will add nodes.
in versions >=0.15.2:
in versions <0.15.2:
I don't think discard should ever add anything to a PMap
This caused serious headache for me as we were using a transformation with discard to remove an empty map with a specific key if it existed, but when we bumped the version of pyrsistent we were using, that transformation started adding new empty maps one level up from the potential location of the empty map.
For example:
versions <0.15.2
versions >=0.15.2