diff options
author | Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> | 2022-04-11 22:33:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 22:33:00 (GMT) |
commit | 8a35ce3796e92f8a826955753920ca0567dbe343 (patch) | |
tree | 20e960af2ba6f62f68541bda80af4f096068c41d /Tools | |
parent | 3869a839d5f14a91978c6158a03c68fac5e938dd (diff) | |
download | cpython-8a35ce3796e92f8a826955753920ca0567dbe343.zip cpython-8a35ce3796e92f8a826955753920ca0567dbe343.tar.gz cpython-8a35ce3796e92f8a826955753920ca0567dbe343.tar.bz2 |
gh-91428: Add _PyOpcode_OpName to opcode.h of debug builds (GH-91430)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/scripts/generate_opcode_h.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py index 3b79dc6..6b5cc7d 100644 --- a/Tools/scripts/generate_opcode_h.py +++ b/Tools/scripts/generate_opcode_h.py @@ -108,6 +108,14 @@ def main(opcode_py, outfile='Include/opcode.h'): for i, (op, _) in enumerate(opcode["_nb_ops"]): fobj.write(DEFINE.format(op, i)) + fobj.write("\n") + fobj.write("#ifdef Py_DEBUG\n") + fobj.write("static const char *const _PyOpcode_OpName[256] = {\n") + for name in opmap: + fobj.write(f''' [{name}] = "{name}",\n''') + fobj.write("};\n") + fobj.write("#endif\n") + fobj.write(footer) |