Issue 28821: generate_opcode_h.py crash when run with python2 (original) (raw)

Created on 2016-11-28 16:22 by florin.papa, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
generate_opcode_h.patch florin.papa,2016-11-28 16:22 review
Messages (8)
msg281882 - (view) Author: Florin Papa (florin.papa) * Date: 2016-11-28 16:22
Hello, This is Florin Papa from the Dynamic Scripting Languages Optimizations team in Intel Corporation. In changeset 105360:46e2755b022c [1] the generate_opcode_h.py script was modified to use tokenize.open() in order to avoid a Resource Warning. The tokenize module does not have an 'open' attribute in python2, therefore the build will crash if python3 is not present on the system. The patch attached checks if the tokenize module has the 'open' attribute. If it does, the current implementation will be used. Otherwise, it will fall back to the old implementation. Thank you, Florin [1] https://hg.python.org/cpython/rev/46e2755b022c
msg281895 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-28 17:15
I don't understand why do you run Tools/scripts/generate_opcode_h.py. It seems like Makefile wants to run it if Lib/opcode.py is more recent than Include/opcode.h. Can you please try the "make touch" command to not recompile Include/opcode.h? Include/opcode.h is already up to date.
msg281896 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-28 17:16
New changeset a6ea34c8b413 by Victor Stinner in branch 'default': Reintroduce Python2 support in generate_opcode_h.py https://hg.python.org/cpython/rev/a6ea34c8b413
msg281897 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-28 17:19
Anyway, I reintroduced the Python 2, just for practical reasons :-) I knew that my change dropped Python 2 support, but I didn't notice that the Makefile might have to run the script to be able to build the ./python binary. So the script can be used on python2.
msg281959 - (view) Author: Florin Papa (florin.papa) * Date: 2016-11-29 07:52
Whenever I did a fresh clone, the Tools/scripts/generate_opcode_h.py would be called. Thank you for fixing this.
msg281963 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-29 08:02
> Whenever I did a fresh clone, the Tools/scripts/generate_opcode_h.py would be called. Can you please test "make touch"? This command "fixes" timestamps.
msg281964 - (view) Author: Florin Papa (florin.papa) * Date: 2016-11-29 08:07
I tested and the script is no longer called if you do a "make touch" beforehand.
msg281965 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-29 08:13
Florin Papa added the comment: > I tested and the script is no longer called if you do a "make touch" beforehand. Oh ok, thanks for the test. It confirms that you don't need to run the script to build Python 3. It's a side effect of the Mercurial clone.
History
Date User Action Args
2022-04-11 14:58:40 admin set github: 73007
2016-11-29 08:13:43 vstinner set messages: +
2016-11-29 08:07:28 florin.papa set messages: +
2016-11-29 08:03:00 vstinner set messages: +
2016-11-29 07:52:07 florin.papa set messages: +
2016-11-28 17:19:11 vstinner set status: open -> closedresolution: fixed
2016-11-28 17:19:03 vstinner set messages: +
2016-11-28 17:16:00 python-dev set nosy: + python-devmessages: +
2016-11-28 17:15:35 vstinner set messages: +
2016-11-28 16:35:03 berker.peksag set nosy: + vstinner
2016-11-28 16:22:16 florin.papa create