FS#76193 - [python] IDLE fails to launch
Attached to Project:
Arch Linux
Opened by Joel (jmcb) - Thursday, 13 October 2022, 17:39 GMT
Last edited by Toolybird (Toolybird) - Sunday, 25 December 2022, 21:16 GMT
Opened by Joel (jmcb) - Thursday, 13 October 2022, 17:39 GMT
Last edited by Toolybird (Toolybird) - Sunday, 25 December 2022, 21:16 GMT
|
Details
Description:
``` $ idle Traceback (most recent call last): File "/usr/bin/idle", line 3, in <module> from idlelib.pyshell import main File "/usr/lib/python3.10/idlelib/pyshell.py", line 53, in <module> from idlelib import debugger File "/usr/lib/python3.10/idlelib/debugger.py", line 7, in <module> from idlelib import macosx File "/usr/lib/python3.10/idlelib/macosx.py", line 7, in <module> from test.support import requires, ResourceDenied ModuleNotFoundError: No module named 'test' ``` This appears to be because of the way the pkgbuild removes the `test` module (https://github.com/archlinux/svntogit-packages/blob/packages/python/trunk/PKGBUILD#L108) and may cause other issues Additional info: * package version(s) 3.10.8-1 * config and/or log files etc. * link to upstream bug report, if any Steps to reproduce: |
This task depends upon
Closed by Toolybird (Toolybird)
Sunday, 25 December 2022, 21:16 GMT
Reason for closing: Fixed
Additional comments about closing: @yan12125 says "Issue gone with Python 3.10.9"
Sunday, 25 December 2022, 21:16 GMT
Reason for closing: Fixed
Additional comments about closing: @yan12125 says "Issue gone with Python 3.10.9"
I have searched through the installed package and only `test.support` was referenced (not only in idlelib). The split is still very effective as the split python-tests package is even larger than the python package.
$ idle
Traceback (most recent call last):
File "/usr/bin/idle", line 3, in <module>
from idlelib.pyshell import main
File "/usr/lib/python3.10/idlelib/pyshell.py", line 53, in <module>
from idlelib import debugger
File "/usr/lib/python3.10/idlelib/debugger.py", line 7, in <module>
from idlelib import macosx
File "/usr/lib/python3.10/idlelib/macosx.py", line 7, in <module>
from test.support import requires, ResourceDenied
ModuleNotFoundError: No module named 'test.support'
$ pacman -Q python
python 3.10.8-2
If I create an empty file /usr/lib/python3.10/test/__init__.py, IDLE can start.
$ ls -lah /usr/lib/python3.10/test/
total 20K
drwxr-xr-x 3 root root 4.0K Oct 14 01:20 ./
drwxr-xr-x 37 root root 12K Oct 14 01:20 ../
drwxr-xr-x 3 root root 4.0K Oct 14 01:20 support/
You may try to see if `python -c "from test.support import *"` works and probably strace it to find out what it tries to open.
Some side notes:
* community/python-augeas also has /usr/lib/python3.10/site-packages/test/__init__.py
* There is a feature request to check such files in namcap https://gitlab.archlinux.org/pacman/namcap/-/issues/22
The problem here is that creating the "test" directory without an "__init__.py" file implicitly creates a *namespace package* (see: https://docs.python.org/3/reference/import.html#namespace-packages) which can radically alter the normal python import process. Any users who coincidently have another directory/package called "test" somewhere on their import path may suddenly start seeing import-errors, depending on which directory/package python happens to find first. This is largely out of the user's control, since *any* package could legitimately install its own "test" modules into one of the "test" directories found on the import path. Whether a user is affected or not will depend on the mix of python packages they currently happen to have installed (including the ones they may have installed via pip under $HOME/.local/lib).
It's clear from the python source code that "test" is intended to be a regular package rather than a namespace package. So if the "test.support" subpackage is included by default, its parent "test" package should also include an empty "__init__.py" file, even if the other "test" modules/subpackages aren't also installed by default.
By the way, that commit also mentions 3.11.0 is never affected.