On 09/08/2016 03:03 PM, Dominik George wrote:
Hi,

I am encountering a strange bug in my project OSMAlchemy:
https://github.com/Natureshadow/OSMAlchemy/issues/4

The model is a lot like in this example:
https://groups.google.com/group/sqlalchemy/attach/e0e54817232da/mwe.py?part=0.1&authuser=0&view=1

I cannot make a real MWE for this bug because I really have
no idea how to trigger it reproducibly. What I do is this:
https://github.com/Natureshadow/OSMAlchemy/blob/master/tests/model.py#L109

I create an object of type OSMNode (see 
https://github.com/Natureshadow/OSMAlchemy/blob/master/osmalchemy/model.py#L152),
then add several tags to the .tags dictionary, which proxies it to the OSMTag 
class.
Then I go and retrieve the whole dictionary again.

Well, in Python 2, I get the dictionary with the keys and values I set before.
In Python 3, *sometimes* the values are missing. But only sometimes.
Roughly, in 1/3 of the times I run the test suite, it failes because
the dictionary is lacking values.

I really do not know how to provide easier access to the code that
produces the bug, but I really hope someone can still look at it and tell me 
why this
fails 1.3 of the time in Python 3.

make sure you set the environment variable PYTHONHASHSEED=random, then run your tests repeatedly. This variable produces a random hash seed for dictionaries and will smoke out dictionary-ordering based bugs more clearly so that you can localize the source of it. If this reproduces the issue in Py2K you'll know you have a dict ordering bug rather than something to do with Py3K. If Py3K, I'd look around for things like "some_list = dict.items()", which is only going to send an iterator in Py3K, not a list.





Cheers,
Nik


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to