Skip to content

fix: support Python 3.14 removal of _const_node_type_names from ast#839

Open
muhamedfazalps wants to merge 1 commit into
python-rope:masterfrom
muhamedfazalps:fix/const-node-type-names-py314
Open

fix: support Python 3.14 removal of _const_node_type_names from ast#839
muhamedfazalps wants to merge 1 commit into
python-rope:masterfrom
muhamedfazalps:fix/const-node-type-names-py314

Conversation

@muhamedfazalps

Copy link
Copy Markdown

Fixes #836

Python 3.14 removed the internal _const_node_type_names mapping from the ast module. The existing fallback only supported Python < 3.8, causing rope to fail on Python >= 3.14.

This fix splits the fallback:

  • Python >= 3.14: map to Constant
  • Older: keep legacy names

All 70 tests pass.

Python 3.14 removed the internal _const_node_type_names mapping from
the ast module and uses ast.Constant for all constant node types.
The existing fallback only supported Python < 3.8, causing an
ImportError on Python >= 3.14.

Split the fallback into two paths:
- Python >= 3.14: map all constant types to 'Constant'
- Older Python: keep the legacy type names (NameConstant, Num, Str, etc.)

Fixes python-rope#836.
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.

ImportError: cannot import name '_const_node_type_names' from 'ast' (/usr/lib/python3.14/ast.py)

1 participant