This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017年12月14日 23:11 by vstinner, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4873 | merged | vstinner, 2017年12月14日 23:16 | |
| PR 4875 | merged | vstinner, 2017年12月15日 00:00 | |
| PR 4884 | merged | vstinner, 2017年12月15日 15:00 | |
| Messages (5) | |||
|---|---|---|---|
| msg308343 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年12月14日 23:11 | |
Python pretends that hash randomization is always enabled, but it's not: $ PYTHONHASHSEED=0 python3 -c 'import sys; print(sys.flags.hash_randomization)' 1 vstinner@apu$ PYTHONHASHSEED=0 python3 -c 'import sys; print(hash("abc"))' 4596069200710135518 vstinner@apu$ PYTHONHASHSEED=0 python3 -c 'import sys; print(hash("abc"))' 4596069200710135518 vstinner@apu$ PYTHONHASHSEED=0 python3 -c 'import sys; print(hash("abc"))' 4596069200710135518 => sys.flags.hash_randomization must be zero Moreover, the -R flag is always ignored, it's not possible to override the PYTHONHASHSEED environment variable: vstinner@apu$ PYTHONHASHSEED=0 python3 -R -c 'import sys; print(sys.flags.hash_randomization)' 1 vstinner@apu$ PYTHONHASHSEED=0 python3 -R -c 'import sys; print(hash("abc"))' 4596069200710135518 vstinner@apu$ PYTHONHASHSEED=0 python3 -R -c 'import sys; print(hash("abc"))' 4596069200710135518 vstinner@apu$ PYTHONHASHSEED=0 python3 -R -c 'import sys; print(hash("abc"))' 4596069200710135518 I expect that -R enables hash randomization and overrides PYTHONHASHSEED environment variable. Attached PR fixes these issues and adds an unit test. |
|||
| msg308348 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年12月14日 23:51 | |
New changeset 358e5e17a51ba00742bfaee4557a94c3c4179c22 by Victor Stinner in branch 'master': bpo-32329: Fix -R option for hash randomization (#4873) https://github.com/python/cpython/commit/358e5e17a51ba00742bfaee4557a94c3c4179c22 |
|||
| msg308354 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年12月15日 00:39 | |
New changeset 22097aaa77b4f0473552fe840358d77e5b9a253f by Victor Stinner in branch '3.6': bpo-32329: Fix sys.flags.hash_randomization (#4875) https://github.com/python/cpython/commit/22097aaa77b4f0473552fe840358d77e5b9a253f |
|||
| msg308355 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年12月15日 00:43 | |
"PYTHONHASHSEED=0 python3 -R" now enables hash randomization on master (Python 3.7), I also fixed the sys.flags.hash_randomization value when using PYTHONHASHSEED=0. I chose to not modify the behaviour of the -R option in Python 3.6. I dislike having to document a behaviour change in a minor Python version (3.6.x). I only fixed the value of sys.flags.hash_randomization in Python 3.6. |
|||
| msg308405 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年12月15日 15:29 | |
New changeset 642d67b4f25262889b43f91ad2a96ca0e37fd5a2 by Victor Stinner in branch 'master': bpo-32329: Add versionchanged to -R option doc (#4884) https://github.com/python/cpython/commit/642d67b4f25262889b43f91ad2a96ca0e37fd5a2 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:55 | admin | set | github: 76510 |
| 2017年12月15日 15:41:41 | vstinner | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2017年12月15日 15:29:08 | vstinner | set | messages: + msg308405 |
| 2017年12月15日 15:00:39 | vstinner | set | pull_requests: + pull_request4780 |
| 2017年12月15日 00:43:00 | vstinner | set | messages: + msg308355 |
| 2017年12月15日 00:39:50 | vstinner | set | messages: + msg308354 |
| 2017年12月15日 00:00:11 | vstinner | set | pull_requests: + pull_request4769 |
| 2017年12月14日 23:51:24 | vstinner | set | messages: + msg308348 |
| 2017年12月14日 23:16:46 | vstinner | set | keywords:
+ patch stage: patch review pull_requests: + pull_request4766 |
| 2017年12月14日 23:11:20 | vstinner | create | |