-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Can't properly compare dictionaries if specific key used #22
Comments
@inoks Thanks for reporting this. This is caused by pickle caring about dictionary order which I was not aware of: >>> import pickle
>>> a={'title': 1, 'http://purl.org/rss/1.0/modules/content/:encoded': '1'}
>>> b={'http://purl.org/rss/1.0/modules/content/:encoded': '1', 'title': 1}
>>> a==b
True
>>> pickle.dumps(a)==pickle.dumps(b)
False
>>> pickle.dumps(a)
"(dp0\nS'http://purl.org/rss/1.0/modules/content/:encoded'\np1\nS'1'\np2\nsS'title'\np3\nI1\ns."
>>> pickle.dumps(b)
"(dp0\nS'title'\np1\nI1\nsS'http://purl.org/rss/1.0/modules/content/:encoded'\np2\nS'1'\np3\ns." I will fix it as soon as I can. |
Testing further, it works correctly 90% of times in python3. I'm gonna be refactoring some code to make this work. |
Hey, I'm wondering if this is related to the issue I'm having:
|
@ThriceGood Yep, I need to fork Pickle and make it sort data while serializing. I will do that this weekend. |
@ThriceGood I looked at your notes again and you are correct, that is a whole different issue and it is currently by design. I will open a ticket and add you there so we can discuss. |
This issue is fixed in 1.5.0 release. I will put it on pypi today. |
Unfortunately that update does not helps with my case, I will put more complex example later. |
@inoks Yes, please post an example that fails and reopen the ticket then. Thanks! |
Hi!
I'm trying to compare xml documents converted to dict and here issue:
I expected result should be the same - empty dictionaries.
The text was updated successfully, but these errors were encountered: