New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
put opcode information in one place #62061
Comments
Right now, opcode information is duplicated in Include/opcode.h and Lib/opcode.py. I should only have to update one manually and have the other one generated automatically. opcode.h should probably be generated by a script from opcode.py. |
Here is a simple script which prints the opcode.h in console. We can redirect it as required. |
Second version of the script with the fix for HAVE_ARGUMENT |
Third revision with fixed empty spaces at the end of the lines. |
As we discussed on #python-dev channel this new patch includes the script in Tools/scripts/generate_opcode_h.py and it also contains the required Makefile.pre.in change so that it gets auto(re)generated at compile time if required. |
Version 2 of the patchset edited as per review. |
Patch looks good to me. |
Please add the file to .hgtouch as well, and verify that "make touch" works correctly. |
New patch with .hgtouch file details. |
New patch with proper changesets. |
New patch from a clean repo, with changed opcode.h |
New patch with changes as suggested by Brett. |
New changeset 56e7fa27f979 by Kushal Das in branch 'default': |
FYI, this broke building in a separate object directory (again!) for multiple reasons: it's running the script without specifying Even if it were importing the right opcode.py, relying on 'import' or 'execfile' here sounds like a bad idea: it means the opcode module of the *target* Python needs to be compatible with the Python that the generate_opcode_h.py script runs with. Since the syntax of opcode.h is much more constrained, a more flexible approach, in my opinion, would be to parse opcode.h to produce opcode.py (or an _opcode.py with just the definitions, that opcode.py would then import.) |
Here's a minimal patch to at least make the current mechanism work when using a separate build directory. I still don't like the fact that this is importing opcode.py in a different Python than the target Python. Nor do I like that the script hardcodes information about the opcodes (specifically, the first opcode to HAVE_ARGUMENT.) This feels like it's not actually better for maintenance than the previous solution. |
New changeset 2b187c9e3e92 by Thomas Wouters in branch 'default': |
This generator script breaks the daily OSX DMG builds on my bolen-dmg buildslave for the 3.x branch. The issue is with the use of "with" as the slave uses Python 2.5 to build the installer. Now, that's old, and I'm not even sure how necessary the daily builds are to keep running, but I believe the Mac build-installer script still tries to target 2.5 as a minimum - though I'm not sure if that's true for all build tools. But the fix is fairly simple (a __future__ import). See attached patch. Alternatively, if the minimum Python to build the installer should be bumped, I can work on that for the slave. |
New changeset 1fd9c3f6cf68 by Ned Deily in branch 'default': |
Thanks, David. Ideally, the generator script shouldn't run during an installer build since presumably the generated file should be up-to-date in the repo. "make touch" could handle that but the installer build does use a separate build/object directory and doesn't currently use "make touch". For Python 3.5, the installer build now does need at least a Python 2.6 to build the documentation but there's no reason to unnecessarily break the main build with such a simple fix available. |
It would be possible to have the daily DMG builder run "make touch". |
Martin, it could if "make touch" worked when building outside of the source directory (bpo-21383). |
Currently an explicit Is anything left to do in this issue? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: