mirror of
https://github.com/python/cpython.git
synced 2025-11-04 03:44:55 +00:00
gh-101678: Merge math_1_to_whatever() and math_1() (#101730)
`math_1_to_whatever()` is no longer useful, since all existing uses of it convert to `float`. Earlier versions of Python used `math_1_to_whatever` with an integer target; see gh-16991 for the PR where that use was removed.
This commit is contained in:
parent
58395759b0
commit
45fa12aec8
1 changed files with 2 additions and 10 deletions
|
|
@ -875,9 +875,7 @@ is_error(double x)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
math_1_to_whatever(PyObject *arg, double (*func) (double),
|
math_1(PyObject *arg, double (*func) (double), int can_overflow)
|
||||||
PyObject *(*from_double_func) (double),
|
|
||||||
int can_overflow)
|
|
||||||
{
|
{
|
||||||
double x, r;
|
double x, r;
|
||||||
x = PyFloat_AsDouble(arg);
|
x = PyFloat_AsDouble(arg);
|
||||||
|
|
@ -903,7 +901,7 @@ math_1_to_whatever(PyObject *arg, double (*func) (double),
|
||||||
/* this branch unnecessary on most platforms */
|
/* this branch unnecessary on most platforms */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return (*from_double_func)(r);
|
return PyFloat_FromDouble(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* variant of math_1, to be used when the function being wrapped is known to
|
/* variant of math_1, to be used when the function being wrapped is known to
|
||||||
|
|
@ -951,12 +949,6 @@ math_1a(PyObject *arg, double (*func) (double))
|
||||||
OverflowError.
|
OverflowError.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
math_1(PyObject *arg, double (*func) (double), int can_overflow)
|
|
||||||
{
|
|
||||||
return math_1_to_whatever(arg, func, PyFloat_FromDouble, can_overflow);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
math_2(PyObject *const *args, Py_ssize_t nargs,
|
math_2(PyObject *const *args, Py_ssize_t nargs,
|
||||||
double (*func) (double, double), const char *funcname)
|
double (*func) (double, double), const char *funcname)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue