Skip to content

idlelib: stray comma makes __repr__ format a one-element tuple #161477

Closed

Description

@PavlNekrasov

Bug report

The comma inside the substitution field makes the expression a one-element
tuple, so repr() returns ('WidgetRedirector',)(Text<.text>) instead of
WidgetRedirector(Text<.text>). The same mistake is duplicated in
OriginalCommand.__repr__ in the same file.

def __repr__(self):
w = self.widget
return f"{self.__class__.__name__,}({w.__class__.__name__}<{w._w}>)"

def __repr__(self):
return f"{self.__class__.__name__,}({self.redir!r}, {self.operation!r})"

Found by Linux Verification Center (linuxtesting.org) with SVACE

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. terryjreedy commented on Nov 6, 2026

    @terryjreedy
    Member

    Extracted from closed PR #161423

  2. added a commit that references this issue on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-IDLEtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions