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

ImmutableDicts should throw errors on attempted mutation #88

Open
presheaf opened this issue Jun 18, 2024 · 1 comment · May be fixed by #89
Open

ImmutableDicts should throw errors on attempted mutation #88

presheaf opened this issue Jun 18, 2024 · 1 comment · May be fixed by #89
Assignees

Comments

@presheaf
Copy link

When you attempt to e.g. insert a key in an ImmutableDict object, nothing happens - no error is thrown or anything. This means that bugs can pass undetected, and is unfortunate. For example, I was parsing an EDN file and forgot that the map within it would become immutable, treating it as a regular Python dict by attempting to insert keys, then ran into strange behavior because my insertions were being silently ignored. See below for an example:

import edn_format
d = edn_format.immutable_dict.ImmutableDict({"apple": 1, "pear": 2})
d["banana"] = 3                 # does not throw an error, just is silently ignored
print(d["banana"])              # oops, KeyError
@swaroopch
Copy link
Owner

Hi! Thanks for reporting the issue. I have not used or updated this library in a while, so I'm unlikely to look into this myself. I would encourage & welcome pull requests to fix this issue. Thanks.

bfontaine added a commit that referenced this issue Jun 24, 2024
@bfontaine bfontaine linked a pull request Jun 24, 2024 that will close this issue
@bfontaine bfontaine self-assigned this Jun 24, 2024
bfontaine added a commit that referenced this issue Jul 5, 2024
bfontaine added a commit that referenced this issue Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants