Skip to content

Conversation

@ararslan
Copy link
Member

This is a backport of #52354 directly to the release-1.10 branch.

)

When a type is defined in one module but its methods are defined
elsewhere, `show_method_table` errors due to an incorrect lookup of the
defining module used to determine colors for printing. In particular,
the code had been assuming that the type is defined in the module in
which its constructor's first method (in the sense of
`first(methods())`) is defined, which isn't always true.

The color used for printing the module name needs to be determined on a
per-method basis and can't be correctly done based on the method table's
module. For each method, we attempt to derive the module for the method
table to which the method was added, then determine whether it's the
same as the defining module for the method.

Fixes #49382
Fixes #49403
Fixes #52043

Co-Authored-By: Jameson Nash <[email protected]>
(cherry picked from commit 40bc64c)
@ararslan ararslan added bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. labels Dec 22, 2023
@KristofferC
Copy link
Member

KristofferC commented Dec 23, 2023

Put into #52622

@ararslan ararslan deleted the aa/backport-52354 branch January 5, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants