diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-06-17 13:57:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 13:57:27 (GMT) |
commit | 231aad38493c871dd32930a21d256cbacd2ae20c (patch) | |
tree | 93c8e378e647443dcbcbc25b2c35e9052bcbef31 /Modules | |
parent | 1ce2656f13e726b3b99d4c968926908cff1f460a (diff) | |
download | cpython-231aad38493c871dd32930a21d256cbacd2ae20c.zip cpython-231aad38493c871dd32930a21d256cbacd2ae20c.tar.gz cpython-231aad38493c871dd32930a21d256cbacd2ae20c.tar.bz2 |
bpo-37315: Deprecate accepting floats in math.factorial(). (GH-14147)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mathmodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 82a9a14..a75a3c9 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -1981,6 +1981,12 @@ math_factorial(PyObject *module, PyObject *arg) PyObject *result, *odd_part, *pyint_form; if (PyFloat_Check(arg)) { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "Using factorial() with floats is deprecated", + 1) < 0) + { + return NULL; + } PyObject *lx; double dx = PyFloat_AS_DOUBLE((PyFloatObject *)arg); if (!(Py_IS_FINITE(dx) && dx == floor(dx))) { |