-
Notifications
You must be signed in to change notification settings - Fork 15
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
Tests fail with frozendict 2.0.6 #36
Comments
first bad version is frozendict 2.0.4 |
I talked about this with @H-Shay. We couldn't seem to reproduce it! I noticed that frozendict's source code contained a C extension and wondered if that might be required to see the failure. To test if you're using the C extension, use
Having done so, the test failed. |
Confirming that my frozendict is using the C extension. |
As @DMRobertson noted above, it appears that the frozendict object created by the C extension is incompatible with our code here: python-canonicaljson/canonicaljson.py Line 25 in f691369
I think the team needs to take a look at this to determine what to do in this situation, in the meantime it appears that if you avoid using the C extension it should work. |
The "quick" solution would probably to also determine if the C-extensions are being used and copy the dict in that case. (I'm guessing there's no equivalent version of That's a bit hacky, but I'm not sure there are other solutions. A better fallback might be to try and copy on attribute error: try:
return obj._dict
except AttributeError:
return dict(obj) |
I wrote these notes up elsewhere but probably should have stuck them on github. For completeness: I can see at least three implementations of
There's also some discussion here by the current maintainer of frozendict. They were frustrated that the stdlib |
A quick skim of the frozendict C extension reveals a surprising amount of hashtable implementation-y code: https://github.com/Marco-Sulla/python-frozendict/blob/master/frozendict/src/3_6/frozendictobject.c which makes me suspect the C extension has its own dict implementation and there's no Python |
Yeah, I'm guessing it's CPython's builtin dict, but with the mutability interface removed? |
Ah, it actually is a copy of the code! |
Just trying to update my Synapse dependencies and noticed that one test for canonicaljson failed when using the latest release of the new frozendict.
This is testing the following versions:
The text was updated successfully, but these errors were encountered: