-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
unittest import loop with pre-release Python #4376
Comments
FWIW, I listed "D Language" because it is its import of pathlib (which uses fnmatch, thus completing the loop) that triggers the exception, but I don't actually believe the D tool is at fault. |
Traced this a little bit. On Windows, the import of try:
from posix import _path_normpath
except ImportError:
def normpath(path):
...
else:
def normpath(path):
# stuff making use of _path_normpath But at the point this is happening in the initialization chain, |
Okay, more understanding now, feel a little slow having it take this long. Two things contribute to make this fail:
So as seen in the chain above, Solutions I can see (both work): in |
For Python 3.12+, cpython module "posixpath" test-imports 'posix', expecting it to fail on win32. However, for this one test program, since it's in SCons/Platform, that directory as the "script path" is in sys.path, and it finds our "posix" module, thus breaking things. This removes that element from the path - it's not put back because we don't actually need it here. Fixes SCons#4376 Unlrelated - UtilTests.py is moved down into SCons/Util, to follow the usual naming conventions where the unit test is in the package dir. Signed-off-by: Mats Wichmann <[email protected]>
For Python 3.12+, cpython module "posixpath" test-imports 'posix', expecting it to fail on win32. However, for this one test program, since it's in SCons/Platform, that directory as the "script path" is in sys.path, and it finds our "posix" module, thus breaking things. This removes that element from the path - it's not put back because we don't actually need it here. Fixes SCons#4376 Signed-off-by: Mats Wichmann <[email protected]>
Oops, missed that SCons/Platform/virtualenvTests.py needed the same hack as SCons/Platform/PlatformTests.py (in PR SCons#4381) Signed-off-by: Mats Wichmann <[email protected]>
Further fix issue #4376 posix platform
Filing this so it's recorded - at the moment a bit stumped.
In the last two Python 3.12 betas, the Platform unit tests fail on Windows with an import loop.
An unsubstantiated theory is that it's no longer possible to have a local module file named "posix". Standard library module names should be considered reserved. The case of posix is strange, it's a submodule of os with instructions never to import it directly:
Is it possible that changes to the import system and internal Python checks based on whether
posix
is available are now being fooled by us having imported our ownposix
module?Anyway, here are the two fails showing the broken import chain:
The text was updated successfully, but these errors were encountered: