[Python-Dev] PYC filename and optimization (original) (raw)

Victor Stinner victor.stinner at gmail.com
Thu Nov 5 05:33:56 EST 2015


Hi,

While working on the FAT Python project to try to optimize CPython, I have an issue with the cached .pyc files. I would like to have one .pyc without optimization when the FAT mode is disabled (default) and one .pyc with optimization when the FAT mode is enabled (-F command line option). Currently, I'm using this filenames:

With -O:

With -OO:

Is it the "correct" way to name .pyc files? I had to modify unit tests which expected an exact filename.

An alternative would be to add a new dot:

Or should I add a flag to the cache tag ("cpython-36")?

CPython adds the "d" suffix to the cache tag in debug build, but in my case the flag would be added dynamically at Python startup. The FAT mode is enabled by the -F command line option, not by a compilation flag.

Victor



More information about the Python-Dev mailing list