[issue24468] Expose C level compiler flag constants to Python code

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

opcode.patch is okay for 3.5.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24468
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24468] Expose C level compiler flag constants to Python code

2015-06-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Making _opcode a builtin module rather than an extension module makes more 
sense to me than adding more random stuff to the sys module.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24468
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24468] Expose C level compiler flag constants to Python code

2015-06-19 Thread Nick Coghlan

Nick Coghlan added the comment:

Bringing a design discussion back from the code review, since I didn't explain 
the problem to be solved very well, and instead jumped straight to recommending 
a specific solution.

Currently, dis has a dictionary mapping from hardcoded compiler flag values (in 
decimal, no less!) to flag names. The inspect module then iterates over this 
dictionary at import time to publish the CO_* constants as module level 
attributes in inspect.

Neither dis.COMPILER_FLAG_NAMES nor the inspect.CO_* constants are documented, 
and the *C* level flag values aren't published to the Python layer anywhere 
(hence the hardcoding of the magic numbers in dis).

For the kind of code that needs to interrogate the flags in the issue 24400 
patch, inspect and dis are also not appropriate things to adopt as dependencies.

However, I like Larry's suggestion of adopting the _opcode module as our 
standard vector for passing this information up from the C layer to the Python 
layer better than my original idea of using code objects themselves.

The opcode values themselves could potentially also be exposed that way 
(they're currently duplicated by hand in Lib/opcode.py).

--
title: Expose compiler flag constants as code object attributes - Expose C 
level compiler flag constants to Python code

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24468
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com