Skip to content
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

Python 3.13 alpha breaks explain() #4504

Closed
mwichmann opened this issue Mar 22, 2024 · 3 comments
Closed

Python 3.13 alpha breaks explain() #4504

mwichmann opened this issue Mar 22, 2024 · 3 comments

Comments

@mwichmann
Copy link
Collaborator

A change in Python 3.13 on Windows has causes unexpected output from --debug=explain. This doesn't come up often, of course, but the test suite does try to tickle the explainer behavior, and now we're seeing:

C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe test\explain\basic.py
STDOUT =========================================================================
6c6,9
< scons: rebuilding `file1' because `file1.in' changed
---
> scons: rebuilding `file1' because:
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
>            `file1.in' changed
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
8c11,14
< scons: rebuilding `file2' because `yyy' changed
---
> scons: rebuilding `file2' because:
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
>            `yyy' changed
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
10a17
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
12a20
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
14c22,28
< scons: rebuilding `file5' because `C:\Users\mats\AppData\Local\Temp\scons\testcmd.8680.tzpsvwcy\inc\bbb.k' changed
---
> scons: rebuilding `file5' because:
>            `\Users\mats\AppData\Local\Temp\scons\testcmd.8680.tzpsvwcy\inc\aaa' is no longer a dependency
>            `\Users\mats\AppData\Local\Temp\scons\testcmd.8680.tzpsvwcy\inc\bbb.k' is no longer a dependency
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
>            `C:\Users\mats\AppData\Local\Temp\scons\testcmd.8680.tzpsvwcy\inc\aaa' is a new dependency
>            `C:\Users\mats\AppData\Local\Temp\scons\testcmd.8680.tzpsvwcy\inc\bbb.k' is a new dependency
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
19a34
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
20a36
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency

FAILED test of C:\Users\mats\Documents\github\scons\scripts\scons.py
        at line 680 of C:\Users\mats\Documents\github\scons\testing\framework\TestCommon.py (_complete)
        from line 775 of C:\Users\mats\Documents\github\scons\testing\framework\TestCommon.py (run)
        from line 458 of C:\Users\mats\Documents\github\scons\testing\framework\TestSCons.py (run)
        from line 262 of C:\Users\mats\Documents\github\scons\test\explain\basic.py

and

C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe test\explain\save-info.py
STDOUT =========================================================================
4c4,7
< scons: rebuilding `file1' because `file1.in' changed
---
> scons: rebuilding `file1' because:
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
>            `file1.in' changed
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
6c9,12
< scons: rebuilding `file2' because `yyy' changed
---
> scons: rebuilding `file2' because:
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
>            `yyy' changed
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
8a15
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
10a18
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency
14c22,28
< scons: rebuilding `file5' because `C:\Users\mats\AppData\Local\Temp\scons\testcmd.19048.0_f116ml\inc\bbb.k' changed
---
> scons: rebuilding `file5' because:
>            `\Users\mats\AppData\Local\Temp\scons\testcmd.19048.0_f116ml\inc\aaa' is no longer a dependency
>            `\Users\mats\AppData\Local\Temp\scons\testcmd.19048.0_f116ml\inc\bbb.k' is no longer a dependency
>            `\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is no longer a dependency
>            `C:\Users\mats\AppData\Local\Temp\scons\testcmd.19048.0_f116ml\inc\aaa' is a new dependency
>            `C:\Users\mats\AppData\Local\Temp\scons\testcmd.19048.0_f116ml\inc\bbb.k' is a new dependency
>            `C:\Users\mats\AppData\Local\Programs\Python\Python313\python.exe' is a new dependency

FAILED test of C:\Users\mats\Documents\github\scons\scripts\scons.py
        at line 680 of C:\Users\mats\Documents\github\scons\testing\framework\TestCommon.py (_complete)
        from line 775 of C:\Users\mats\Documents\github\scons\testing\framework\TestCommon.py (run)
        from line 458 of C:\Users\mats\Documents\github\scons\testing\framework\TestSCons.py (run)
        from line 187 of C:\Users\mats\Documents\github\scons\test\explain\save-info.py

Initial suspicion is that this is caused by python/cpython#113829 which changes the behavior of isabs, and is the result (in part) of an ancient Python bug from 2007 (2.5 days)!.

It seems like it's only the debugging routine (SCons.Node.Node.explain) that's confused by this, which would make it relatively low priority. The only other open issue against 3.13 is #4502 which does not at first glance seem like it's likely related to this.

@mwichmann
Copy link
Collaborator Author

mwichmann commented Mar 23, 2024

As an FYI:

C:\Users\mats\Documents\github\scons>py -3.12
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> s = r'\users\mats'
>>> os.path.isabs(s)
True
>>> ^Z

C:\Users\mats\Documents\github\scons>py -3.13
Python 3.13.0a5 (tags/v3.13.0a5:076d169, Mar 12 2024, 21:29:03) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> s = r'\users\mats'
>>> os.path.isabs(s)
False
>>> ^Z

@mwichmann
Copy link
Collaborator Author

Seems like this and #4502 are the same issue after all, rooted in the str_to_node methods in FileNodeInfo and DirNodeInfo.

mwichmann added a commit to mwichmann/scons that referenced this issue Mar 24, 2024
Python 3.13 (alpha) changes the behavior of isabs() on Windows. SCons
has places where it does splitdrive on an absolute path, then checks
if the path part is absolute - this answer is now False, which caused
some interesting test fails.  Do the check on the original path to get
a more accurate answer.  There may be more subtle issues with the Python
change, but first fix the ones we can see.

Simplify the setup of _my_splitdrive() a bit: every caller is supposed to
check do_splitdrive but a couple of locations did not. Remove the special
check for UNC support, all Python versions SCons runs on do UNC handling,
so just eliminate that bit.

Fixes SCons#4502, SCons#4504.

Signed-off-by: Mats Wichmann <mats@linux.com>
mwichmann added a commit to mwichmann/scons that referenced this issue Mar 24, 2024
Python 3.13 (alpha) changes the behavior of isabs() on Windows. SCons
has places where it does splitdrive on an absolute path, then checks
if the path part is absolute - this answer is now False, which caused
some interesting test fails.  Do the check on the original path to get
a more accurate answer.  There may be more subtle issues with the Python
change, but first fix the ones we can see.

Simplify the setup of _my_splitdrive() a bit: every caller is supposed to
check do_splitdrive but a couple of locations did not. Remove the special
check for UNC support, all Python versions SCons runs on do UNC handling,
so just eliminate that bit.

Fixes SCons#4502, SCons#4504.

Signed-off-by: Mats Wichmann <mats@linux.com>
@mwichmann
Copy link
Collaborator Author

Completed by #4505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant