-
Notifications
You must be signed in to change notification settings - Fork 64
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
non-determinstic behavior on dict-like objects with attributes #243
Comments
this seems related to #233 |
Thanks for the reproducing case and analysis. I agree it should be consistent and am surprised it isn't. |
Hello! I have a similar problem. I'm using tomlkit to parse some TOML file and want to update them accordingly to our standard. Tomlkit is using a dict-like object and I also found that sometimes setitem but most often setattr is used. I've read into glom and found that you recommend to use register to tell glom how to handle this.
Basically what I would prefer is that I can tell glom to handle parsed_toml as a dict every time. It is a dict with additional features. ;) |
reproduce with
Sometimes the above prints
{'a': {'at1': 1, 'at2': 2}}
and sometimes
{'a': {'at1': 1, 'at2': 2, 'at3': 3}}
some analysis
This seems to be caused by get_handler() sometimes returning
setitem
and sometimes returningsetattr
. (Maybe the correct behavior in this case is to disallow ambiguous paths. But in any case it should return the same thing consistently).This in turn is caused by different orderings in the assign op type tree (I think the type tree should be constant):
for the first result, and
for the second.
The text was updated successfully, but these errors were encountered: