Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
address review: correct gamma/lgamma error msgs
  • Loading branch information
skirpichev committed Feb 6, 2025
commit 81ae02603a17a04edaab29def6c8bfa8652eff77
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