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: fix typo in news & gamma/lgamma error messages
  • Loading branch information
skirpichev committed Feb 6, 2025
commit 53b68c2f05d55982efacce2fb83efd99e7356495
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 positive integer, got {x}"):
f"expected a noninteger or positive integer, got {x}"):
Comment thread
skirpichev marked this conversation as resolved.
math.gamma(x)
x = 1.0
with self.assertRaisesRegex(ValueError,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Added more detailed messages for domain errors in the :mod:`math` module.
Patch by Charlie Zhao and Sergey B Kirpichev.
Patch by Charlie Zhao and Sergey B Kirpichev.
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 positive integer, got %s")
"expected a noninteger 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 positive integer, got %s")
"expected a noninteger 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