summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-10-25 09:46:28 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-10-25 09:46:28 (GMT)
commit76464494bc1a6779cc4839a28238fb7ea4104a5a (patch)
tree420dc4593bc35c2ecd6611059c38f050375151ba /Modules
parent837cd06d36f7e69fc51e5bce7631041161f9b864 (diff)
downloadcpython-76464494bc1a6779cc4839a28238fb7ea4104a5a.zip
cpython-76464494bc1a6779cc4839a28238fb7ea4104a5a.tar.gz
cpython-76464494bc1a6779cc4839a28238fb7ea4104a5a.tar.bz2
Fix math.factorial KeyboardInterrupt segfault. Thanks Amaury for report and diagnosis.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mathmodule.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 2c4cc73..142eca4 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -1330,14 +1330,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 */