diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 0749367045dfa9..6618da0176aaad 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -144,8 +144,8 @@ Number-theoretic functions .. function:: factorial(n) - Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not integral or - is negative. + Return *n* factorial as an integer. Raises :exc:`TypeError` if *n* is not an integer. + Raises :exc:`ValueError` if *n* is negative. .. 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..e2651e5fed69e9 100644 --- a/Modules/clinic/mathmodule.c.h +++ b/Modules/clinic/mathmodule.c.h @@ -110,7 +110,8 @@ PyDoc_STRVAR(math_factorial__doc__, "\n" "Find n!.\n" "\n" -"Raise a ValueError if x is negative or non-integral."); +"Raises TypeError if n is not an integer.\n" +"Raises ValueError if n is negative."); #define MATH_FACTORIAL_METHODDEF \ {"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},