Skip to content

3.13.0b4: AttributeError: 'Constant' object has no attribute 'values'  #122307

Closed as not planned
@penguinpee

Description

@penguinpee

Bug report

Bug description:

With the update to 3.13.0b4 in Fedora I saw tests failing for rope and astor with:

AttributeError: 'Constant' object has no attribute 'values'. Did you mean: 'value'?

The tests in question succeeded with Python 3.13.0b3. Reverting d24ec8a solves the issue.

A reproducer for rope:

from rope.refactor import patchedast

source = 'f"abc{a:01}"\n'
patchedast.get_patched_ast(source, True)

Results in:

Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    patchedast.get_patched_ast(source, True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 18, in get_patched_ast
    return patch_ast(ast.parse(source), source, sorted_children)
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 37, in patch_ast
    walker(node)
    ~~~~~~^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 80, in __call__
    return method(node)
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 625, in _Module
    self._handle(node, list(node.body), eat_spaces=True)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 113, in _handle
    self(child)
    ~~~~^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 80, in __call__
    return method(node)
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 443, in _Expr
    self._handle(node, [node.value])
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 113, in _handle
    self(child)
    ~~~~^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 80, in __call__
    return method(node)
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 408, in _JoinedStr
    self._handle(node, children)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 113, in _handle
    self(child)
    ~~~~^^^^^^^
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 80, in __call__
    return method(node)
  File "/usr/lib/python3.13/site-packages/rope/refactor/patchedast.py", line 416, in _FormattedValue
    for val in node.format_spec.values:
               ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Constant' object has no attribute 'values'. Did you mean: 'value'?

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions