diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2023-03-21 23:48:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 23:48:19 (GMT) |
commit | d1a89ce5156cd4e1eff5823ec2200885c43e395e (patch) | |
tree | a652e4416cc4d0f62d4bb5015dcf404a0b9dd4e8 /Modules/mathmodule.c | |
parent | 41ef502d740b96ca6333a2d0202df7cce4a84e7d (diff) | |
download | cpython-d1a89ce5156cd4e1eff5823ec2200885c43e395e.zip cpython-d1a89ce5156cd4e1eff5823ec2200885c43e395e.tar.gz cpython-d1a89ce5156cd4e1eff5823ec2200885c43e395e.tar.bz2 |
gh-102839: remove AC for math.log (GH-102863)
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r-- | Modules/mathmodule.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index c9a2be6..473936e 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2284,33 +2284,22 @@ loghelper(PyObject* arg, double (*func)(double)) } -/*[clinic input] -math.log - - x: object - [ - base: object(c_default="NULL") = math.e - ] - / - -Return the logarithm of x to the given base. - -If the base not specified, returns the natural logarithm (base e) of x. -[clinic start generated code]*/ - +/* AC: cannot convert yet, see gh-102839 and gh-89381, waiting + for support of multiple signatures */ 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(PyObject *module, PyObject * const *args, Py_ssize_t nargs) { PyObject *num, *den; PyObject *ans; - num = loghelper(x, m_log); - if (num == NULL || base == NULL) + if (!_PyArg_CheckPositional("log", nargs, 1, 2)) + return NULL; + + num = loghelper(args[0], m_log); + if (num == NULL || nargs == 1) return num; - den = loghelper(base, m_log); + den = loghelper(args[1], m_log); if (den == NULL) { Py_DECREF(num); return NULL; @@ -2322,6 +2311,10 @@ math_log_impl(PyObject *module, PyObject *x, int group_right_1, return ans; } +PyDoc_STRVAR(math_log_doc, +"log(x, [base=math.e])\n\ +Return the logarithm of x to the given base.\n\n\ +If the base not specified, returns the natural logarithm (base e) of x."); /*[clinic input] math.log2 @@ -4045,7 +4038,7 @@ static PyMethodDef math_methods[] = { {"lcm", _PyCFunction_CAST(math_lcm), METH_FASTCALL, math_lcm_doc}, MATH_LDEXP_METHODDEF {"lgamma", math_lgamma, METH_O, math_lgamma_doc}, - MATH_LOG_METHODDEF + {"log", _PyCFunction_CAST(math_log), METH_FASTCALL, math_log_doc}, {"log1p", math_log1p, METH_O, math_log1p_doc}, MATH_LOG10_METHODDEF MATH_LOG2_METHODDEF |