-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Regression in compileall ddir parameter when recursing #82896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There appears to have been a regression introduced in the compileall library back with Python 3.5 as a result of commit f1a8df0 . The issues appears when compiling a hierarchy of directories with the 'ddir' parameter specified (either in the compile_dir() function or via the '-d' command line parameter). Examining the code before the f1a8df0 commit suggests the original intent for the 'ddir' parameter, when recursing into subdirectories, was to alter the root of the path displayed in exception traces. That means that the hierarchical directory structure of the reported source path in each compiled file was maintained, and only the root directory being compiled was replaced with ddir. More recently two new parameters, 'stripdir' and 'prependdir', have been added with commit 8e7bb99 which seem to largely reimplement the missing behaviour in a different way. The current behaviour does not seem very useful or expected. I think it would be helpful to restore the original behaviour and would be happy to contribute a PR to do so. Additionally it may be worth consulting the submitter of bpo-38112 whether the alternative arguments are still necessary once the regression is fixed, though this is optional and not needed to fix the core issue. Here's a simple script to demonstrate the above: mkdir -p library/a/a cat <<'EOF' > library/init.py python3 -m compileall -b -d /usr/lib library python3 -c 'from library import go; go()' And the resulting output which shows that each module is claiming to be raised from the same location: Listing 'library'... Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/__init__.py", line 2, in go
AssertionError: dummy
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/__init__.py", line 2, in go
AssertionError: dummy
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/__init__.py", line 2, in go
AssertionError: dummy |
Can this be closed? I can't reproduce. $ python -c 'from library.a.a import go; go()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/a/a/__init__.py", line 2, in go
raise AssertionError('dummy')
AssertionError: dummy
$ python -c 'from library.a import go; go()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/a/__init__.py", line 2, in go
raise AssertionError('dummy')
AssertionError: dummy
$ python -c 'from library import go; go()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/__init__.py", line 2, in go
raise AssertionError('dummy')
AssertionError: dummy |
Nevermind! I ran it with my system python binary, which is patched to against this. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: