From 56b78c4d92ada85d01e9fe5c9b1d496ea97e78d3 Mon Sep 17 00:00:00 2001 From: mkaraev Date: Mon, 12 May 2025 00:36:33 +0500 Subject: [PATCH 1/6] fix math.factorial documentation --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 0749367045dfa9..5398560211a820 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -144,7 +144,7 @@ Number-theoretic functions .. function:: factorial(n) - Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not integral or + Return *n* factorial as an integer. Raises :exc:`TypeError` if *n* is not integral or is negative. .. versionchanged:: 3.10 From b332cb66439c6c8053c69407d721300b5cd28f19 Mon Sep 17 00:00:00 2001 From: mkaraev Date: Mon, 12 May 2025 12:10:19 +0500 Subject: [PATCH 2/6] fix math.factorial documentation --- Doc/library/math.rst | 3 +-- Modules/clinic/mathmodule.c.h | 6 ++---- Modules/mathmodule.c | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 5398560211a820..500224170342eb 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:`TypeError` if *n* is not integral or - is negative. + Return *n* factorial as an integer. .. 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 4c2c8acd8f69d8..9df73b187bb827 100644 --- a/Modules/clinic/mathmodule.c.h +++ b/Modules/clinic/mathmodule.c.h @@ -108,9 +108,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__}, @@ -1112,4 +1110,4 @@ math_ulp(PyObject *module, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=634773bd18cd3f93 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=77e7b8c161c39843 input=a9049054013a1b77]*/ diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 11d9b7418a25a2..b5e33d43d2fbed 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2009,12 +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=06200bf38384f7ae]*/ { long x, two_valuation; int overflow; From 9b7282fa9b139e19ab9e3c73c7c977890e63dc0d Mon Sep 17 00:00:00 2001 From: mkaraev Date: Mon, 12 May 2025 12:27:43 +0500 Subject: [PATCH 3/6] fix math.factorial documentation --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 500224170342eb..394a462b9468e5 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -144,7 +144,7 @@ Number-theoretic functions .. function:: factorial(n) - Return *n* factorial as an integer. + Return factorial of the nonnegative integer *n*. .. versionchanged:: 3.10 Floats with integral values (like ``5.0``) are no longer accepted. From acdd82f343aaf1e441458435d6a14b91c20409a5 Mon Sep 17 00:00:00 2001 From: mkaraev Date: Mon, 12 May 2025 12:40:43 +0500 Subject: [PATCH 4/6] fix math.factorial documentation --- Modules/mathmodule.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index b5e33d43d2fbed..40abd69f0a6600 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2008,12 +2008,11 @@ math.factorial / Find n!. - [clinic start generated code]*/ static PyObject * math_factorial(PyObject *module, PyObject *arg) -/*[clinic end generated code: output=6686f26fae00e9ca input=06200bf38384f7ae]*/ +/*[clinic end generated code: output=6686f26fae00e9ca input=366cc321df3d4773]*/ { long x, two_valuation; int overflow; From 729859cb31c8a3d2c4d3ebcf502731cbe2f0832c Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 12 May 2025 12:06:24 +0300 Subject: [PATCH 5/6] Update Doc/library/math.rst --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 394a462b9468e5..1dd93c201f6910 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -144,7 +144,7 @@ Number-theoretic functions .. function:: factorial(n) - Return factorial of the nonnegative integer *n*. + Return factorial of the non-negative integer *n*. .. versionchanged:: 3.10 Floats with integral values (like ``5.0``) are no longer accepted. From 016c6b95a3bd6171c6048b159b2440a8896fe77d Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 12 May 2025 12:14:26 +0300 Subject: [PATCH 6/6] Update Doc/library/math.rst --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 1dd93c201f6910..394a462b9468e5 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -144,7 +144,7 @@ Number-theoretic functions .. function:: factorial(n) - Return factorial of the non-negative integer *n*. + Return factorial of the nonnegative integer *n*. .. versionchanged:: 3.10 Floats with integral values (like ``5.0``) are no longer accepted.