Skip to content

gh-89381: Fix signature for math.log and cmath.log #101115

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

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix signature for :func:`math.log` and :func:`cmath.log`.
6 changes: 3 additions & 3 deletions Modules/clinic/cmathmodule.c.h

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

39 changes: 16 additions & 23 deletions Modules/clinic/mathmodule.c.h

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

6 changes: 3 additions & 3 deletions Modules/cmathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,17 +952,17 @@ cmath_tanh_impl(PyObject *module, Py_complex z)
cmath.log

z as x: Py_complex
base as y_obj: object = NULL
base as y_obj: object(c_default="NULL") = cmath.e
/

log(z[, base]) -> the logarithm of z to the given base.
Return the logarithm of z to the given base.

If the base not specified, returns the natural logarithm (base e) of z.
[clinic start generated code]*/

static PyObject *
cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj)
/*[clinic end generated code: output=4effdb7d258e0d94 input=230ed3a71ecd000a]*/
/*[clinic end generated code: output=4effdb7d258e0d94 input=6783d68473d21cf3]*/
{
Py_complex y;

Expand Down
7 changes: 2 additions & 5 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2366,9 +2366,7 @@ loghelper(PyObject* arg, double (*func)(double))
math.log

x: object
[
base: object(c_default="NULL") = math.e
]
/

Return the logarithm of x to the given base.
Expand All @@ -2377,9 +2375,8 @@ If the base not specified, returns the natural logarithm (base e) of x.
[clinic start generated code]*/

static PyObject *
math_log_impl(PyObject *module, PyObject *x, int group_right_1,
PyObject *base)
/*[clinic end generated code: output=7b5a39e526b73fc9 input=0f62d5726cbfebbd]*/
math_log_impl(PyObject *module, PyObject *x, PyObject *base)
/*[clinic end generated code: output=1dead263cbb1e854 input=59b97db7030bb40b]*/
{
PyObject *num, *den;
PyObject *ans;
Expand Down