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 vstinner
Recipients brett.cannon, vstinner
Date 2016-01-18.09:10:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453108257.94.0.438143755637.issue26145@psf.upfronthosting.co.za>
In-reply-to
Content
Attached patch implements the largest part of the PEP 511:

* add sys.get_code_transformers() and sys.set_code_transformers()
* add sys.implementation.optim_tag
* add -o command line option setting sys.implementation.optim_tag
* modify importlib to use sys.implementation.optim_tag to build .pyc filenames
* modify importlib to raise an ImportError when the .pyc file is missing, the .py is available, and the optimizer tag created from code transformers is different than the current sys.implementation.optim_tag
* add Lib/test/test_pep511.py: test changes especially bytecode and AST transformers
* add a PeepholeOptimizer object created by default for sys.set_code_transformers()
* skip the peephole optimizer when -o noopt is used
* add sys field to the PyInterpreterState structure: used by _PySys_GetCodeTransformers() to get code transformers
* update unit tests to use the optimizer to create the .pyc filename

An optimizer tag must contain characters: '.', '-', directory separators or NUL character.

Brett Canon proposed to not include the optimizer tag in .pyc filenames if it is "opt" to limit backward incompatible changes.

Note: The PEP 511 is under discussion on python-ideas. The patch implements the first version of the PEP, sent to python-ideas, so it doesn't include proposed changes like changing code_transformer() prototype to "def code_transformer(self, code, context)".

See also the issue #26100: add test.support.optim_args_from_interpreter_flags().
History
Date User Action Args
2016-01-18 09:10:59vstinnersetrecipients: + vstinner, brett.cannon
2016-01-18 09:10:57vstinnersetmessageid: <1453108257.94.0.438143755637.issue26145@psf.upfronthosting.co.za>
2016-01-18 09:10:57vstinnerlinkissue26145 messages
2016-01-18 09:10:57vstinnercreate