Skip to content

fix[cartesian]: remove usage of deprecated ast types - #2772

Merged
romanc merged 3 commits into
GridTools:mainfrom
romanc:romanc/ast-parser-avoid-warnings
Aug 11, 2026
Merged

fix[cartesian]: remove usage of deprecated ast types#2772
romanc merged 3 commits into
GridTools:mainfrom
romanc:romanc/ast-parser-avoid-warnings

Conversation

@romanc

@romanc romanc commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Python 3.14 will remove support for a couple of (long) deprecated ast types. Currently produces warnings like

DeprecationWarning: ast.Ellipsis is deprecated and will be removed in Python 3.14; use ast.Constant instead

or

DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead

This PR updates the (cartesian) gtscript frontend to not use those types anymore and instead rely on things that are future proof, thus eliminating the warning messages.

Requirements

  • All fixes and/or new features come with corresponding tests.
    Covered by existing tests cases.
  • Important design decisions have been documented in the appropriate ADR inside the docs/development/ADRs/ folder.
    N/A

romanc added 2 commits August 10, 2026 16:24
Python 3.14 will remove support for a couple of (long) deprecated `ast`
types. Currently produces warnigns like

```none
DeprecationWarning: ast.Ellipsis is deprecated and will be removed in Python 3.14; use ast.Constant instead
```

or

```none
DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
```

This PR updates the (cartesian) gtscript frontent to not use those types
anymore and instead rely on things that are futureproof.
@romanc
romanc marked this pull request as ready for review August 11, 2026 07:06

@FlorianDeconinck FlorianDeconinck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🧹

@romanc
romanc merged commit 44093e2 into GridTools:main Aug 11, 2026
20 checks passed
@romanc
romanc deleted the romanc/ast-parser-avoid-warnings branch August 11, 2026 08:11
egparedes added a commit that referenced this pull request Aug 13, 2026
Three files conflicted, all against #2772 and #2754.

'gtscript_frontend.py': #2772 removed the same deprecated 'ast' usage this
branch fixes, but replaced the ellipsis check with
'isinstance(cn, types.EllipsisType)', which never matches — that is the type
of the '...' object, not of its AST node ('ast.Constant' with an 'Ellipsis'
value). Kept this branch's '_is_ellipsis_node' helper, which does match, and
took #2772's better 'visit_Expr': it drops only *string* constant statements
rather than every constant, matching the documented intent.

The two cartesian test hunks were pure additions on both sides (the ellipsis
tests here, the IntEnum tests from #2323) and are both kept.

'test_diagnostic_messages.py': #2754 added PEP 695 alias tests; this branch
deleted 'test_add_note_folded_into_str_on_py310', whose
'skipif(version_info >= (3, 11))' means it runs on no supported version. Both
intents are preserved, which leaves 'import sys' unused — dropped.

#2754 also added test cases spelled with the deprecated 'typing' aliases this
branch removes ('List[SampleIntAlias]', 'type SampleGenericAlias[T] =
Tuple[T, T]', ...). Those are migrated to the builtin spelling, which git
could not do since the two changes touch different lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants