Skip to content

Commit 7615f71

Browse files
authored
[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 07df106)
1 parent f70e54c commit 7615f71

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Propagate errors during generic class construction.

‎Objects/typevarobject.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,9 @@ PyObject *
22712271
_Py_subscript_generic(PyThreadState* unused, PyObject *params)
22722272
{
22732273
params = unpack_typevartuples(params);
2274+
if (params == NULL) {
2275+
return NULL;
2276+
}
22742277

22752278
PyInterpreterState *interp = _PyInterpreterState_GET();
22762279
if (interp->cached_objects.generic_type == NULL) {

0 commit comments

Comments
 (0)