[Cython] cython tests and py3k hash randomization

Vitja Makarov vitja.makarov at gmail.com
Thu Feb 23 21:52:04 CET 2012

Recent py3k version has new feature "hash randomization" it solves
some security issues.
But has some drawbacks, for instance, dict.items() order is now
unknown. So it breaks
randomly some doctests that rely on exact order of dict items.

vitja at mchome:~/python$ ./py3k/bin/python -c  "print({'a':1, 'b':2})"
{'b': 2, 'a': 1}
vitja at mchome:~/python$ ./py3k/bin/python -c  "print({'a':1, 'b':2})"
{'a': 1, 'b': 2}

As a workaround we can set PYTHONHASHSEED environment variable to zero
for all cyhon-*-tests targets

This also affects generated code it internally depends on order of
items returned by dict.items()


More information about the cython-devel mailing list