This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients gvanrossum, larry, ncoghlan, superluser, yselivanov
Date 2015-06-20.05:32:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1434778326.38.0.894211219238.issue24468@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2015-06-20 05:32:06ncoghlansetrecipients: + ncoghlan, gvanrossum, larry, yselivanov, superluser
2015-06-20 05:32:06ncoghlansetmessageid: <1434778326.38.0.894211219238.issue24468@psf.upfronthosting.co.za>
2015-06-20 05:32:06ncoghlanlinkissue24468 messages
2015-06-20 05:32:05ncoghlancreate