pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/101492.patch

double (*func)(double)) } /* Else let libm handle it by itself. */ - return math_1(arg, func, 0, "math domain error"); + return math_1(arg, func, 0, err_msg); } @@ -2402,11 +2401,11 @@ math_log_impl(PyObject *module, PyObject *x, PyObject *base) PyObject *num, *den; PyObject *ans; - num = loghelper(x, m_log); + num = loghelper(x, m_log, "math.log() expects a positive input, got '%R'."); if (num == NULL || base == Py_None) return num; - den = loghelper(base, m_log); + den = loghelper(base, m_log, "math.log() expects a positive input, got '%R'."); if (den == NULL) { Py_DECREF(num); return NULL; @@ -2432,7 +2431,7 @@ static PyObject * math_log2(PyObject *module, PyObject *x) /*[clinic end generated code: output=5425899a4d5d6acb input=08321262bae4f39b]*/ { - return loghelper(x, m_log2); + return loghelper(x, m_log2, "math.log2() expects a positive input, got '%R'."); } @@ -2449,7 +2448,7 @@ static PyObject * math_log10(PyObject *module, PyObject *x) /*[clinic end generated code: output=be72a64617df9c6f input=b2469d02c6469e53]*/ { - return loghelper(x, m_log10); + return loghelper(x, m_log10, "math.log10() expects a positive input, got '%R'."); } From c0c1e2d4697ba1a0297a10fbf9aa3acd6a4023f7 Mon Sep 17 00:00:00 2001 From: CharlieZhao Date: Wed, 1 Feb 2023 16:43:08 +0800 Subject: [PATCH 3/8] Add a NEWS entry. --- .../next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst diff --git a/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst b/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst new file mode 100644 index 00000000000000..c479c2d5ffee99 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst @@ -0,0 +1,2 @@ +Make several math functions support custom error messages. ``math.sqrt()`` +and ``math.log()`` now provide more helpful error messages. \ No newline at end of file From 1a491f293bbdf4598e68fc5e4f2ed3169ee0f97a Mon Sep 17 00:00:00 2001 From: CharlieZhao Date: Wed, 1 Feb 2023 17:12:41 +0800 Subject: [PATCH 4/8] add new line --- .../next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst b/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst index c479c2d5ffee99..75b65f6c75d7eb 100644 --- a/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst +++ b/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst @@ -1,2 +1,2 @@ Make several math functions support custom error messages. ``math.sqrt()`` -and ``math.log()`` now provide more helpful error messages. \ No newline at end of file +and ``math.log()`` now provide more helpful error messages. From 4cd75b01bf25882ae8feded08a0a1b4c30e66dd9 Mon Sep 17 00:00:00 2001 From: CharlieZhao Date: Mon, 6 Feb 2023 10:00:15 +0800 Subject: [PATCH 5/8] fix nit --- Modules/mathmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index c28aa9031fd4e6..af6cd189e1259d 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -1361,8 +1361,8 @@ FUNC1(sinh, sinh, 1, FUNC1(sqrt, sqrt, 0, "sqrt($module, x, /)\n--\n\n" "Return the square root of x.", - "math.sqrt() expects a non-negative input, got '%R'.\n" - "See cmath.sqrt() for variation that supports complex numbers") + "math.sqrt() expects a nonnegative input, got '%R'.\n" + "See cmath.sqrt() for a variation that supports complex numbers") FUNC1(tan, tan, 0, "tan($module, x, /)\n--\n\n" "Return the tangent of x (measured in radians).", From 75a7c5ccf989de331b9a0035c287ff4fa6c1c9dc Mon Sep 17 00:00:00 2001 From: Charlie Zhao Date: Mon, 22 Jul 2024 15:43:04 +0800 Subject: [PATCH 6/8] Update Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- .../Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst b/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst index 75b65f6c75d7eb..3619b2b9dd4b5b 100644 --- a/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst +++ b/Misc/NEWS.d/next/Library/2023-02-01-16-41-31.gh-issue-101410.Dt2aQE.rst @@ -1,2 +1,2 @@ -Make several math functions support custom error messages. ``math.sqrt()`` -and ``math.log()`` now provide more helpful error messages. +Make several math functions support custom error messages. :func:`math.sqrt` and :func:`math.log` +now provide more helpful error messages. From 4b2ec23d690e1d025cdc5fd849ba789c9a8ce27d Mon Sep 17 00:00:00 2001 From: Charlie Zhao Date: Mon, 22 Jul 2024 15:48:39 +0800 Subject: [PATCH 7/8] Update Modules/mathmodule.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Modules/mathmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 21ced7d5bb5927..553787549d5b01 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -1261,7 +1261,7 @@ FUNC1(sqrt, sqrt, 0, "sqrt($module, x, /)\n--\n\n" "Return the square root of x.", "math.sqrt() expects a nonnegative input, got '%R'.\n" - "See cmath.sqrt() for a variation that supports complex numbers") + "See cmath.sqrt() for a variant that supports complex numbers") FUNC1(tan, tan, 0, "tan($module, x, /)\n--\n\n" "Return the tangent of x (measured in radians).", From 3fc73e9671ccb57bc324ec34e9aee405bc86aa57 Mon Sep 17 00:00:00 2001 From: Charlie Zhao Date: Mon, 22 Jul 2024 15:49:57 +0800 Subject: [PATCH 8/8] Update Modules/mathmodule.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Modules/mathmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 553787549d5b01..2bfbeb62d73940 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2236,7 +2236,7 @@ math_modf_impl(PyObject *module, double x) in that int is larger than PY_SSIZE_T_MAX. */ static PyObject* -loghelper(PyObject* arg, double (*func)(double), const char* err_msg) +loghelper(PyObject* arg, double (*func)(double), const char *err_msg) { /* If it is int, do it ourselves. */ if (PyLong_Check(arg)) { pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy