https://github.com/python/cpython/commit/7615f71333ec2406c09aee0a7c0a57d53b6d9f10
commit: 7615f71333ec2406c09aee0a7c0a57d53b6d9f10
branch: 3.14
author: Jelle Zijlstra <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-10-20T19:22:00Z
summary:
[3.14] gh-159739: [typing] Handle generic alias construction errors (GH-159772)
(#159929)
Backport the typevarobject.c fix; Python 3.14 does not decref subargs on the
generic-alias substitution error path.
(cherry picked from commit 07df106f7efa7e5e3f5fba4b4927eaba5bcd98d0)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2026-10-19-20-38-17.gh-issue-159739.b62fc9.rst
M Objects/typevarobject.c
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2026-10-19-20-38-17.gh-issue-159739.b62fc9.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-19-20-38-17.gh-issue-159739.b62fc9.rst
new file mode 100644
index 00000000000000..f61a0f76143570
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-19-20-38-17.gh-issue-159739.b62fc9.rst
@@ -0,0 +1 @@
+Propagate errors during generic class construction.
diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c
index 3cbc471f465f54..628963b5770214 100644
--- a/Objects/typevarobject.c
+++ b/Objects/typevarobject.c
@@ -2271,6 +2271,9 @@ PyObject *
_Py_subscript_generic(PyThreadState* unused, PyObject *params)
{
params = unpack_typevartuples(params);
+ if (params == NULL) {
+ return NULL;
+ }
PyInterpreterState *interp = _PyInterpreterState_GET();
if (interp->cached_objects.generic_type == NULL) {
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]