https://github.com/python/cpython/commit/532acbd0fa3d9c6a889d76be6e5adc20fd097e77
commit: 532acbd0fa3d9c6a889d76be6e5adc20fd097e77
branch: 3.13
author: mkaraev <maruf.karae...@gmail.com>
committer: sobolevn <m...@sobolevn.me>
date: 2025-05-12T12:17:17Z
summary:

[3.13] gh-133904: Fix `math.factorial` documentation (GH-133907) (#133922)

* [3.13] gh-133904: Fix `math.factorial` documentation (GH-133907)
(cherry picked from commit 27ed64575d34f04029ba1d353810f3db4f4f045b)

Co-authored-by: mkaraev <maruf.karae...@gmail.com>
Co-authored-by: sobolevn <m...@sobolevn.me>

files:
M Doc/library/math.rst
M Modules/clinic/mathmodule.c.h
M Modules/mathmodule.c

diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 371bdae989eef3..9f8c17bff6b9e6 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -144,8 +144,7 @@ Number-theoretic functions
 
 .. function:: factorial(n)
 
-   Return *n* factorial as an integer.  Raises :exc:`ValueError` if *n* is not 
integral or
-   is negative.
+   Return factorial of the nonnegative integer *n*.
 
    .. versionchanged:: 3.10
       Floats with integral values (like ``5.0``) are no longer accepted.
diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h
index 81eec310ddb21d..99534de0df6425 100644
--- a/Modules/clinic/mathmodule.c.h
+++ b/Modules/clinic/mathmodule.c.h
@@ -54,9 +54,7 @@ PyDoc_STRVAR(math_factorial__doc__,
 "factorial($module, n, /)\n"
 "--\n"
 "\n"
-"Find n!.\n"
-"\n"
-"Raise a ValueError if x is negative or non-integral.");
+"Find n!.");
 
 #define MATH_FACTORIAL_METHODDEF    \
     {"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},
@@ -1011,4 +1009,4 @@ math_ulp(PyObject *module, PyObject *arg)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=755da3b1dbd9e45f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9fe02dc4af07c1e0 input=a9049054013a1b77]*/
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 64a497306b2aac..2d56dc35731c0b 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -2009,13 +2009,11 @@ math.factorial
     /
 
 Find n!.
-
-Raise a ValueError if x is negative or non-integral.
 [clinic start generated code]*/
 
 static PyObject *
 math_factorial(PyObject *module, PyObject *arg)
-/*[clinic end generated code: output=6686f26fae00e9ca input=713fb771677e8c31]*/
+/*[clinic end generated code: output=6686f26fae00e9ca input=366cc321df3d4773]*/
 {
     long x, two_valuation;
     int overflow;

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to