New submission from Gregory P. Smith <g...@krypto.org>:
Easiest to demonstrate as such: ```shell #!/bin/bash mkdir bug touch bug/__init__.py mkdir bug/foo touch bug/foo/__init__.py touch bug/foo/bar.py python3 -m compileall -d "<prefix>" bug python2 -m compileall -d "<prefix>" bug echo "prefix embedded in PY3 pyc code object for lib.foo.bar:" strings bug/foo/__pycache__/bar.cpython-3*.pyc | grep prefix echo "prefix embedded in PY2 pyc code object for lib.foo.bar:" strings bug/foo/bar.pyc | grep prefix ``` Run that script and you'll see: Listing 'bug'... Compiling 'bug/__init__.py'... Listing 'bug/foo'... Compiling 'bug/foo/__init__.py'... Compiling 'bug/foo/bar.py'... Listing bug ... Compiling bug/__init__.py ... Listing bug/__pycache__ ... Listing bug/foo ... Compiling bug/foo/__init__.py ... Listing bug/foo/__pycache__ ... Compiling bug/foo/bar.py ... prefix embedded in PY3 pyc code object for lib.foo.bar: <prefix>/bar.py prefix embedded in PY2 pyc code object for lib.foo.bar: <prefix>/foo/bar.pyt Notice that the Python 3 pyc file contains a code.co_filename of "<prefix>/bar.py" instead of the correct value (that Python 2 inserts) of "<prefix>/foo/bar.py". ---------- messages: 362767 nosy: gregory.p.smith priority: normal severity: normal status: open title: compileall.compile_dir(..., ddir="<prefix>") omits the intermediate package paths when prepending the prefix versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39769> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com