The tool knows how to make a .pyc or .pyo file, depending on a construction variable $CPYTHON_PYC. However:
PEP 3147 introduced .pyc directories and versioning as of Python 3.2. That is, instead of foo.py being compiled to foo.pyc, it by default becomes __pycache__/foo.cpython-311.pyc IFF the compiler version is CPython 3.11.
Then PEP 488 eliminated pyo files entirely as of Python 3.5. They now use an encoding on the .pyc filename, so that foo.py compiled with optimization level 1 yields a filename __pycache__/foo.cpython-311.opt-1.pyc by default.
To be useful in a modern Python environment, those changes need to be accounted for.
The tool knows how to make a
.pycor.pyofile, depending on a construction variable$CPYTHON_PYC. However:PEP 3147 introduced
.pycdirectories and versioning as of Python 3.2. That is, instead offoo.pybeing compiled tofoo.pyc, it by default becomes__pycache__/foo.cpython-311.pycIFF the compiler version is CPython 3.11.Then PEP 488 eliminated
pyofiles entirely as of Python 3.5. They now use an encoding on the.pycfilename, so thatfoo.pycompiled with optimization level 1 yields a filename__pycache__/foo.cpython-311.opt-1.pycby default.To be useful in a modern Python environment, those changes need to be accounted for.