Skip to content

Commit

Permalink
address review: correct gamma/lgamma error msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Feb 6, 2025
1 parent d57a640 commit 81ae026
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -2536,7 +2536,7 @@ def test_exception_messages(self):
"expected a positive input"):
math.log(x)
with self.assertRaisesRegex(ValueError,
f"expected a float or nonnegative integer, got {x}"):
f"expected a float or positive integer, got {x}"):
math.gamma(x)
x = 1.0
with self.assertRaisesRegex(ValueError,
Expand Down
4 changes: 2 additions & 2 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,11 +1232,11 @@ math_floor(PyObject *module, PyObject *number)
FUNC1AD(gamma, m_tgamma,
"gamma($module, x, /)\n--\n\n"
"Gamma function at x.",
"expected a float or nonnegative integer, got %s")
"expected a float or positive integer, got %s")
FUNC1AD(lgamma, m_lgamma,
"lgamma($module, x, /)\n--\n\n"
"Natural logarithm of absolute value of Gamma function at x.",
"expected a float or nonnegative integer, got %s")
"expected a float or positive integer, got %s")
FUNC1D(log1p, m_log1p, 0,
"log1p($module, x, /)\n--\n\n"
"Return the natural logarithm of 1+x (base e).\n\n"
Expand Down

0 comments on commit 81ae026

Please sign in to comment.