fabiocaccamo / python-benedict

:blue_book: dict subclass with keylist/keypath support, built-in I/O operations (base64, csv, html, ini, json, pickle, plist, query-string, toml, xls, xml, yaml), s3 support and many utilities.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internal benedict reference to old value

kikohs opened this issue · comments

I've opened an issue on ORJSON which I'm using to serialize benedict dicts.
ijl/orjson#281

Basically I don't understand why something like this could happen:

from benedict import benedict
import orjson

d = benedict({
    "internal": benedict({
        "mykey": "OLD"
    })
})

d['internal'] = benedict({
    "mykey": "NEW"
})

res = orjson.dumps(d)
print(res)

b'{"internal":{"mykey":"OLD"}}'

It should be "NEW".
Could you please explain how benedict handles sub benedict references?

Or why this would happen, thank you.

@kikohs thank you for reporting this, I will add a test case as soon as possible.

@kikohs you can upgrade to 0.25.2 version.