Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9588593

Browse files
committed
Issue #16305: Merge fix from 3.3.
2 parents a19f601 + 039e0cd commit 9588593

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ Core and Builtins
6262
Library
6363
-------
6464

65+
- Issue #16305: Fix a segmentation fault occurring when interrupting
66+
math.factorial.
67+
6568
- Issue #16116: Fix include and library paths to be correct when building C
6669
extensions in venvs.
6770

Modules/mathmodule.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,14 +1381,13 @@ factorial_odd_part(unsigned long n)
13811381
Py_DECREF(outer);
13821382
outer = tmp;
13831383
}
1384-
1385-
goto done;
1384+
Py_DECREF(inner);
1385+
return outer;
13861386

13871387
error:
13881388
Py_DECREF(outer);
1389-
done:
13901389
Py_DECREF(inner);
1391-
return outer;
1390+
return NULL;
13921391
}
13931392

13941393
/* Lookup table for small factorial values */

0 commit comments

Comments
 (0)