Skip to content

gh-149132: Add module keyword argument to typing.TypeAliasType#149133

Closed
ericmarkmartin wants to merge 1 commit intopython:mainfrom
ericmarkmartin:typealiastype-module-kwarg
Closed

gh-149132: Add module keyword argument to typing.TypeAliasType#149133
ericmarkmartin wants to merge 1 commit intopython:mainfrom
ericmarkmartin:typealiastype-module-kwarg

Conversation

@ericmarkmartin
Copy link
Copy Markdown

@ericmarkmartin ericmarkmartin commented Apr 29, 2026

Add an optional keyword-only module argument to
typing.TypeAliasType that overrides the __module__ attribute inferred by frame introspection. When omitted, behavior is unchanged.

closes #149132.

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Apr 29, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Apr 29, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32475380 | 📁 Comparing 6a48187 against main (d71e3bc)

  🔍 Preview build  

3 files changed
± download.html
± library/typing.html
± whatsnew/changelog.html

Copy link
Copy Markdown
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

I see a good point in adding this parameter :)

ns,
ns,
)
self.assertEqual(ns["TA"].__module__, "x.y")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please, test repr with the custom module, we want to be sure that there will no regression there.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added!

Add an optional keyword-only `module` argument to
`typing.TypeAliasType` that overrides the `__module__` attribute
inferred by frame introspection. When omitted, behavior is unchanged.

closes python#149132.
@ericmarkmartin ericmarkmartin force-pushed the typealiastype-module-kwarg branch from eb3597c to 6a48187 Compare April 29, 2026 21:46
@ericmarkmartin
Copy link
Copy Markdown
Author

Closing in favor of #149172

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.

Add module keyword argument to typing.TypeAliasType

2 participants