You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sagemathgh-41032: Fix sageinspect for Python 3.14
1.In Python 3.14, the AST representation was fully unified to use
``ast.Constant`` nodes for all literal values (numbers, strings,
booleans, None). Previously, Python 3.8-3.13 still generated legacy node
types (``ast.Num``, ``ast.Str``, ``ast.NameConstant``) for backward
compatibility.
The ``SageArgSpecVisitor`` class had visit methods for the legacy node
types but was missing ``visit_Constant()``, causing it to return None
for all constant default argument values when parsing function
signatures on Python 3.14.
This fix adds the ``visit_Constant()`` method to properly handle the
unified AST representation, allowing correct extraction of default
argument values like base=0 in ``Integer.__init__(self, x=None,
base=0)``.
2. In line 464, The output format is changed in python 3.14
- Old format: ``<ast.Assign object at ...>`` contains "Assign"
- New format: ``Assign(targets=[...], ...)`` starts with "Assign"
3. Remove the deprecated visit methods from 3.8 and finally deleted in
python 3.14.
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixessagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixessagemath#12345". -->
### 📝 Checklist
<!-- Put an `x` in all the boxes that apply. -->
- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
### ⌛ Dependencies
<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
sagemath#41028 (part)
URL: sagemath#41032
Reported by: Chenxin Zhong
Reviewer(s): Chenxin Zhong, Copilot, Tobias Diez, user202729
0 commit comments