summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-10-25 09:48:39 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-10-25 09:48:39 (GMT)
commit9588593b791d2c0052296f3df462350280dd3747 (patch)
tree13e7eed5223029b6500ae9f508ee827dddf75c15
parenta19f601fdffab73b2e8d64235c5a44432721a9d1 (diff)
parent039e0cdc28ebcea7a6364d6277f11ed330e38028 (diff)
downloadcpython-9588593b791d2c0052296f3df462350280dd3747.zip
cpython-9588593b791d2c0052296f3df462350280dd3747.tar.gz
cpython-9588593b791d2c0052296f3df462350280dd3747.tar.bz2
Issue #16305: Merge fix from 3.3.
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/mathmodule.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index c2814a0..db55df1 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -62,6 +62,9 @@ Core and Builtins
Library
-------
+- Issue #16305: Fix a segmentation fault occurring when interrupting
+ math.factorial.
+
- Issue #16116: Fix include and library paths to be correct when building C
extensions in venvs.
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index d693da1..3fa52d0 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -1381,14 +1381,13 @@ factorial_odd_part(unsigned long n)
Py_DECREF(outer);
outer = tmp;
}
-
- goto done;
+ Py_DECREF(inner);
+ return outer;
error:
Py_DECREF(outer);
- done:
Py_DECREF(inner);
- return outer;
+ return NULL;
}
/* Lookup table for small factorial values */