Skip to content

gh-133904: math.factorial documentation fix #133907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Doc/library/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 2 additions & 4 deletions Modules/clinic/mathmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2008,13 +2008,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;
Expand Down
Loading