Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-127187: Set correct __module__ attribute for methods of named tuple types #127188

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

XuehaiPan
Copy link
Contributor

@XuehaiPan XuehaiPan commented Nov 23, 2024

Set correct __module__ attribute for methods of named tuple types.

Fixes #127187

@rhettinger rhettinger self-assigned this Nov 23, 2024
method.__qualname__ = f'{typename}.{method.__name__}'
if module is not None:
method.__module__ = module
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need to check module is a str object. In the test, the module argument can be passed with collections (an instance of ModuleType).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected __module__ attribute for NamedTupleType.__new__ method: namedtuple_{typename}
2 participants