[New-bugs-announce] [issue7543] RFE: introduce "enum Py_Opcode"

Dave Malcolm report at bugs.python.org
Sat Dec 19 00:06:46 CET 2009


New submission from Dave Malcolm <dmalcolm at redhat.com>:

Currently, Python's opcodes are defined as preprocessor #defines.  This means that they are 
invisible to the debugger.

I'm attaching:
  (i) a simple script (fixup-opcode-header.py) which converts Include/opcode.h to use an 
anonymous enum for the values
  (ii) a diff containing the results of running the script on trunk's Include/opcode.h
  (iii) a patch that converts usage of "int opcode" to "enum Py_Opcode opcode" in a few 
places

(Is the usage of an anonymous enum acceptable on all compilers that Python supports?  Is it 
going to generate equal machinecode on all compilers, relative to an int?)

With this patch, if I break into PyEval_EvalFrameEx in gdb, the debugger is able to emit 
symbolic values for "opcode":
(gdb) p opcode
$2 = LOAD_CONST

----------
components: Interpreter Core
messages: 96587
nosy: dmalcolm
severity: normal
status: open
title: RFE: introduce "enum Py_Opcode"
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7543>
_______________________________________


More information about the New-bugs-announce mailing list