gh-149171: Make TypeAliasType __module__ writable - #149172
Conversation
ddb11af to
73111a0
Compare
picnixz
left a comment
There was a problem hiding this comment.
You should update the TypeAlias docs (both rST and the one at L2193).
| PyObject *old_module = ta->module; | ||
| Py_XDECREF(old_module); | ||
| ta->module = Py_XNewRef(value); |
There was a problem hiding this comment.
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.
Documentation build overview
15 files changed ·
|
| { | ||
| typealiasobject *ta = typealiasobject_CAST(self); | ||
| Py_BEGIN_CRITICAL_SECTION(self); | ||
| Py_XSETREF(ta->module, Py_XNewRef(value)); |
There was a problem hiding this comment.
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.
c506040 to
eaff263
Compare
c0eeb1f to
aa41fd5
Compare
|
CI failures appear to be due to the Canonical outage. I hope to get this in before the beta though. |
…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 `
closes #149171.