Skip to content

Fix @auto to be safe with tuple-valued attributes#4014

Open
finite-state-machine wants to merge 3 commits intoTextualize:masterfrom
finite-state-machine:patch-1
Open

Fix @auto to be safe with tuple-valued attributes#4014
finite-state-machine wants to merge 3 commits intoTextualize:masterfrom
finite-state-machine:patch-1

Conversation

@finite-state-machine
Copy link

@finite-state-machine finite-state-machine commented Feb 23, 2026

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

AI?

  • AI was NOT used to generate this PR

AI generated PRs may be accepted, but only if @willmcgugan has responded on an issue or discussion.

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate (see note about typos above).
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

When @auto is representing an attribute (__init__() arg) which is emitted as positional (rather than with the attribute name), the implementation yields the value directly. If that value is a tuple, it will be misinterpreted as a (name, value, ...) group, causing TypeErrors later when rendering.

Fixes #4016.

    Problem being fixed:

    When `@auto` is representing an attribute (`__init__()` arg) which
    is emitted as positional (rather than with the attribute name), the
    implementation yields the value directly. If that value is a
    `tuple`, it will be misinterpreted as a `(name, value, ...)` group,
    causing `TypeError`s later when rendering.
@TomJGooding TomJGooding mentioned this pull request Feb 24, 2026
9 tasks
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.

[BUG] @auto-generated __rich_repr__() does not escape tuples

1 participant