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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to