Skip to content

Fix package hash / unparse compat with Python 3.14#51042

Merged
becker33 merged 2 commits intodevelopfrom
hs/fix/deprecated-ast-symbols
Jul 25, 2025
Merged

Fix package hash / unparse compat with Python 3.14#51042
becker33 merged 2 commits intodevelopfrom
hs/fix/deprecated-ast-symbols

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Jul 24, 2025

The first commit ensures forward compatibility with Python 3.14: that version
will remove the s member from Constant, so it will always raise (and
catch) AttributeError.

The second commit merely reduces the noise of warnings related to accessing
ast.Str, ast.Num, et cetera. These warnings show up when running unit tests.
This brings the number of warnings down from ~100K to <5K.

While at it, also fix incorrect function overrides: the argument name is node,
not func in the parent class.

The advantage of the if sys.version_info branches is not only that it's no longer
a condition checked in a loop/traversal, but also that we can easily delete these
functions if we ever require Python 3.8.

@haampie haampie added the v1.0.1 PRs to backport for v1.0.1 label Jul 24, 2025
@haampie haampie added this to the v1.1.0 milestone Jul 24, 2025
@haampie haampie force-pushed the hs/fix/deprecated-ast-symbols branch from eedda45 to b5d8e59 Compare July 24, 2025 20:33
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Jul 25, 2025

Verified locally that

  • package_hash.py tests pass for Python 3.6.15, 3.7.17, 3.8.19, 3.9.19, 3.10.14, 3.11.9, 3.12.6, 3.13.1, 3.14.0rc1.
  • no changes to canonicalized sources of spack/spack-packages for the same Python versions except 3.14 (which cannot be tested, since Spack is not compatible with it before this PR).

@becker33 becker33 merged commit a3dcdb6 into develop Jul 25, 2025
32 checks passed
@becker33 becker33 deleted the hs/fix/deprecated-ast-symbols branch July 25, 2025 11:27
haampie added a commit that referenced this pull request Jul 29, 2025
* package_hash.py: fix TagMultiMethods forward compat with Python 3.14

Signed-off-by: Harmen Stoppels <[email protected]>

* Silence ast.Str warnings for 3.8:3.13

Signed-off-by: Harmen Stoppels <[email protected]>

---------

Signed-off-by: Harmen Stoppels <[email protected]>
@haampie haampie mentioned this pull request Jul 29, 2025
29 tasks
haampie added a commit that referenced this pull request Jul 29, 2025
* package_hash.py: fix TagMultiMethods forward compat with Python 3.14

Signed-off-by: Harmen Stoppels <[email protected]>

* Silence ast.Str warnings for 3.8:3.13

Signed-off-by: Harmen Stoppels <[email protected]>

---------

Signed-off-by: Harmen Stoppels <[email protected]>
alecbcs pushed a commit that referenced this pull request Aug 12, 2025
* package_hash.py: fix TagMultiMethods forward compat with Python 3.14

Signed-off-by: Harmen Stoppels <[email protected]>

* Silence ast.Str warnings for 3.8:3.13

Signed-off-by: Harmen Stoppels <[email protected]>

---------

Signed-off-by: Harmen Stoppels <[email protected]>
alstar555 pushed a commit to alstar555/spack that referenced this pull request Aug 27, 2025
* package_hash.py: fix TagMultiMethods forward compat with Python 3.14

Signed-off-by: Harmen Stoppels <[email protected]>

* Silence ast.Str warnings for 3.8:3.13

Signed-off-by: Harmen Stoppels <[email protected]>

---------

Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Angelica Loshak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0.1 PRs to backport for v1.0.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants