Martin Panter added the comment:
I understand hash randomization was added after this bug was opened. Here is a
demonstration with “video/mp4”, which only has the extension “.mp4” built in.
But my /etc/mime.types file lists “mp4 mp4v mpg4”, so after the second
initialization the behaviour changes:
PYTHONHASHSEED=0 python3.5 -c 'from mimetypes import *;
print(guess_all_extensions("video/mp4")); init();
print(guess_all_extensions("video/mp4"))'
['.mp4', '.mp4v', '.mpg4']
['.mpg4', '.mp4', '.mp4v']
The first extension is always “.mp4”, regardless of hash randomization, due to
the built-in list. But after re-initialization, the first extension depends on
the order in the internal dictionary.
Using an ordered dictionary may work as a bug fix, but the whole initialization
logic is so complex and it would be good to simplify it in the long term.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue4963>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com