[Python-Dev] PYC filename and optimization (original) (raw)
Victor Stinner victor.stinner at gmail.com
Thu Nov 5 05:33:56 EST 2015
- Previous message (by thread): [Python-Dev] Python 3.5.1 release schedule
- Next message (by thread): [Python-Dev] PYC filename and optimization
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
- Lib/pycache/os.cpython-36.pyc: default mode
- Lib/pycache/os.cpython-36.fat-0.pyc: FAT mode
With -O:
- Lib/pycache/os.cpython-36.opt-1.pyc: default mode
- Lib/pycache/os.cpython-36.fat-1.pyc: FAT mode
With -OO:
- Lib/pycache/os.cpython-36.opt-2.pyc: default mode
- Lib/pycache/os.cpython-36.fat-2.pyc: FAT mode
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:
- Lib/pycache/os.cpython-36.fat.pyc
- Lib/pycache/os.cpython-36.fat.opt-1.pyc
- Lib/pycache/os.cpython-36.fat.opt-2.pyc
Or should I add a flag to the cache tag ("cpython-36")?
- Lib/pycache/os.cpython-36f.pyc
- Lib/pycache/os.cpython-36f.opt-1.pyc
- Lib/pycache/os.cpython-36f.opt-2.pyc
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
- Previous message (by thread): [Python-Dev] Python 3.5.1 release schedule
- Next message (by thread): [Python-Dev] PYC filename and optimization
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]