
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2020-02-27 05:18 bygregory.p.smith, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 18676 | merged | gregory.p.smith,2020-02-27 08:47 | |
| PR 18718 | merged | gregory.p.smith,2020-02-29 21:59 | |
| PR 18725 | merged | gregory.p.smith,2020-03-01 18:46 | |
| Messages (11) | |||
|---|---|---|---|
| msg362767 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-27 05:18 | |
Easiest to demonstrate as such:```shell#!/bin/bashmkdir bugtouch bug/__init__.pymkdir bug/footouch bug/foo/__init__.pytouch bug/foo/bar.pypython3 -m compileall -d "<prefix>" bugpython2 -m compileall -d "<prefix>" bugecho "prefix embedded in PY3 pyc code object for lib.foo.bar:"strings bug/foo/__pycache__/bar.cpython-3*.pyc | grep prefixecho "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.pyprefix embedded in PY2 pyc code object for lib.foo.bar:<prefix>/foo/bar.pytNotice 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". | |||
| msg362768 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-27 05:20 | |
This has probably been happening for many 3 releases. I noticed it on 3.6 when investigating a problem with wrong paths in tracebacks coming from code which we used compileall.compile_dir(src_root, quiet=1, ddir="<prefix">) on.I'm guessing ddir= (-d on the cli) isn't widely used? | |||
| msg362782 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-27 07:30 | |
Ironically 3.9a4 gains some compileall enhancements that could be used as an awkward workaround fromhttps://bugs.python.org/issue38112:python 2.7 compile_dir(d, ddir="<foo>") behavior can be had withpython 3.9a4 compile_dir(d, prependdir="<foo>", stripdir=d)I still intend to fix the actual ddir behavior as it is wrong. | |||
| msg362785 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-27 08:02 | |
The regression was caused by the parallelization enhancement implementation fromhttps://bugs.python.org/issue16104 | |||
| msg362787 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-27 08:02 | |
meaning this regression was introduced in 3.5. | |||
| msg362788 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-27 08:04 | |
belated postmortem: if there had been tests against the filename encoded in the pycs living in subdirs as generated by compile_dir, this regression would not have happened. | |||
| msg362956 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-29 01:28 | |
New changeset02673352b5db6ca4d3dc804965facbedfe66425d by Gregory P. Smith in branch 'master':bpo-39769: Fix compileall ddir for subpkgs. (GH-18676)https://github.com/python/cpython/commit/02673352b5db6ca4d3dc804965facbedfe66425d | |||
| msg362961 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-02-29 02:13 | |
keeping this open while i investigate if fixing 3.8 and 3.7 is feasible. if nothing else i'll try to add a note to the docs about the issue in 3.5-3.8 with a code sample suggested workaround. | |||
| msg363077 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-03-01 18:43 | |
New changesetce720d3e0674d6ac6f1b950c20a89be4cfde7853 by Gregory P. Smith in branch '3.8':bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) (GH-18718)https://github.com/python/cpython/commit/ce720d3e0674d6ac6f1b950c20a89be4cfde7853 | |||
| msg363078 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-03-01 19:06 | |
New changeset7c64726ced3d6b5d04537386d6a9ca6d179c3be4 by Gregory P. Smith in branch '3.7':[3.7]bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) (GH-18718) (GH-18725)https://github.com/python/cpython/commit/7c64726ced3d6b5d04537386d6a9ca6d179c3be4 | |||
| msg363079 -(view) | Author: Gregory P. Smith (gregory.p.smith)*![]() | Date: 2020-03-01 19:07 | |
if anyone needs this on their older 3.6 or 3.5 trees, the 3.7/3.8 patch is a trivial backport. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:27 | admin | set | github: 83950 |
| 2020-03-01 19:07:52 | gregory.p.smith | set | status: open -> closed messages: +msg363079 stage: patch review -> commit review |
| 2020-03-01 19:06:58 | gregory.p.smith | set | messages: +msg363078 |
| 2020-03-01 18:46:50 | gregory.p.smith | set | pull_requests: +pull_request18082 |
| 2020-03-01 18:43:07 | gregory.p.smith | set | messages: +msg363077 |
| 2020-02-29 21:59:05 | gregory.p.smith | set | stage: commit review -> patch review pull_requests: +pull_request18075 |
| 2020-02-29 02:13:07 | gregory.p.smith | set | resolution: fixed messages: +msg362961 stage: patch review -> commit review |
| 2020-02-29 01:28:40 | gregory.p.smith | set | messages: +msg362956 |
| 2020-02-27 08:47:19 | gregory.p.smith | set | keywords: +patch stage: needs patch -> patch review pull_requests: +pull_request18036 |
| 2020-02-27 08:04:38 | gregory.p.smith | set | messages: +msg362788 |
| 2020-02-27 08:02:58 | gregory.p.smith | set | messages: +msg362787 versions: + Python 3.5 |
| 2020-02-27 08:02:00 | gregory.p.smith | set | messages: +msg362785 |
| 2020-02-27 07:30:37 | gregory.p.smith | set | messages: +msg362782 |
| 2020-02-27 05:20:15 | gregory.p.smith | set | type: behavior messages: +msg362768 components: + Library (Lib) stage: needs patch |
| 2020-02-27 05:18:05 | gregory.p.smith | create | |