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 jcgoble3
Recipients ezio.melotti, jcgoble3, mrabarnett, pitrou, serhiy.storchaka
Date 2016-02-11.04:05:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455163527.75.0.996534901196.issue26336@psf.upfronthosting.co.za>
In-reply-to
Content
Once a regular expression is compiled with `obj = re.compile()`, it would be nice to have access to the raw bytecode, probably as `obj.code` or `obj.bytecode`, so it can be explored programmatically. Currently, regex bytecode is only stored in a C struct and not exposed to Python code; the only way to examine the compiled version is to pass the `re.DEBUG` flag to `re.compile()`, which prints only to stdout and outputs not the finished bytecode, but a "pretty-printed" intermediate representation useless for programmatic analysis.

This is basically requesting the equivalent of the `co_code` attribute of the code object returned by the built-in `compile()`, but for regular expression objects instead of Python code objects.

Given that the bytecode can actually be multi-byte integers, `regexobj.bytecode` should return a list (perhaps even just the same list passed to the C function?) or an `array.array()` instance, rather than a bytestring.
History
Date User Action Args
2016-02-11 04:05:27jcgoble3setrecipients: + jcgoble3, pitrou, ezio.melotti, mrabarnett, serhiy.storchaka
2016-02-11 04:05:27jcgoble3setmessageid: <1455163527.75.0.996534901196.issue26336@psf.upfronthosting.co.za>
2016-02-11 04:05:27jcgoble3linkissue26336 messages
2016-02-11 04:05:26jcgoble3create