GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-149171: Make TypeAliasType __module__ writable by ericmarkmartin · Pull Request #149172 · python/cpython

Conversation

@ericmarkmartin

@ericmarkmartin ericmarkmartin commented Apr 30, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

closes #149171.

  • Issue: Make TypeAliasType __module__ attribute writable #149171

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericmarkmartin
ericmarkmartin requested a review from JelleZijlstra as a code owner April 30, 2026 05:39
@bedevere-app bedevere-app Bot added the awaiting review label Apr 30, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 30, 2026
Make TypeAliasType __module__ attribute writable #149171
Closed
@ericmarkmartin
ericmarkmartin force-pushed the typealiastype-writable-module branch from ddb11af to 73111a0 Compare April 30, 2026 05:39
This was referenced Apr 30, 2026
Make TypeAliasType __module__ writable python/typing_extensions#744
Merged
gh-149132: Add module keyword argument to typing.TypeAliasType #149133
Closed
picnixz
picnixz reviewed Apr 30, 2026
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You should update the TypeAlias docs (both rST and the one at L2193).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Objects/typevarobject.c Outdated
Comment on lines +2005 to +2007
PyObject *old_module = ta->module;
Py_XDECREF(old_module);
ta->module = Py_XNewRef(value);

@picnixz picnixz Apr 30, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Use Py_XSETREF instead. More generally, making it writable looks like we may introduce races on the free-threaded build so I think the getter/setter will need a critical section. I however don't know whether this should be considered an atomic change or not.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@read-the-docs-community

read-the-docs-community Bot commented Apr 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32505063 | 📁 Comparing aa41fd5 against main (5110738)

  🔍 Preview build  

15 files changed · ± 15 modified

± Modified

  • contents.html
  • download.html
  • genindex-D.html
  • genindex-H.html
  • genindex-Symbols.html
  • genindex-all.html
  • library/faulthandler.html
  • library/functools.html
  • library/gc.html
  • library/http.cookies.html
  • and 5 more...
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JelleZijlstra
JelleZijlstra reviewed May 1, 2026
View reviewed changes
Comment thread Objects/typevarobject.c Outdated
{
typealiasobject *ta = typealiasobject_CAST(self);
Py_BEGIN_CRITICAL_SECTION(self);
Py_XSETREF(ta->module, Py_XNewRef(value));

@JelleZijlstra JelleZijlstra May 1, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Minor but we could move the DECREF on the old value outside the critical section. This could theoretically cause issues if the old value has a very expensive destructor.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericmarkmartin
ericmarkmartin force-pushed the typealiastype-writable-module branch from c506040 to eaff263 Compare May 1, 2026 04:16
@ericmarkmartin
ericmarkmartin requested a review from AlexWaygood as a code owner May 1, 2026 04:16
@python-cla-bot

python-cla-bot Bot commented May 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericmarkmartin
pythongh-149171: Make TypeAliasType __module__ writable
aa41fd5
closes python#149171.
@ericmarkmartin
ericmarkmartin force-pushed the typealiastype-writable-module branch from c0eeb1f to aa41fd5 Compare May 1, 2026 23:50
JelleZijlstra
JelleZijlstra approved these changes May 2, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 2, 2026
@JelleZijlstra

JelleZijlstra commented May 2, 2026

Copy link
Copy Markdown
Member

CI failures appear to be due to the Canonical outage. I hope to get this in before the beta though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JelleZijlstra
JelleZijlstra enabled auto-merge (squash) May 2, 2026 17:08
@JelleZijlstra
JelleZijlstra merged commit a65611e into python:main May 2, 2026
94 of 104 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 2, 2026
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Aug 18, 2026
dgarcia @bmwiedemann
Update python-typing_extensions to version 4.16.0 / rev 33 via SR 137…
93d7cc2
…0852

https://build.opensuse.org/request/show/1370852
by user dgarcia + anag_factory
- Drop not needed patch py314-fix-tests.patch
- Add upstream patch
  remove-obsolete-literal-deduplication-assertion.patch
  (gh#python/typing_extensions#785, bsc#1274786)
- Update to 4.16.0:
  * Avoid a DeprecationWarning when deprecated is applied to a
    coroutine function on Python 3.14.0.
  * Make `typing_extensions.TypeAliasType`'s `__module__` attribute
    writable.  Backport of CPython PR [#149172](python/cpython#149172).
  * Fix setting of `__required_keys__` and `__optional_keys__` when
    inheriting keys with the same name.
  * Add support for `AsyncIterator`, `io.Reader`, `io.Writer` and
    `os.PathLike` protocols as bases for other protocols.
  * Fix incorrect behaviour on Python 3.9 and Python 3.10 that meant
    that calling `isinstance` with
    `
@rennerdo30 rennerdo30 mentioned this pull request Oct 21, 2026
[Historical PR] chore(deps): bump typing-extensions from 4.15.0 to 4.16.0 in /backend rennerdo30/watch-together#48
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@AlexWaygood AlexWaygood Awaiting requested review from AlexWaygood AlexWaygood is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Make TypeAliasType __module__ attribute writable

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ericmarkmartin @JelleZijlstra @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.