Python 3.7 METH_FASTCALL backport (#406)

This commit is contained in:
Gautham 2022-05-13 17:35:12 +05:30 committed by GitHub
parent fec396037a
commit 83b743cf96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 2949 additions and 3356 deletions

View file

@ -1038,7 +1038,7 @@ double_round(double x, int ndigits) {
/* round a Python float v to the closest multiple of 10**-ndigits */
static PyObject *
float_round(PyObject *v, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
float_round(PyObject *v, PyObject **args, Py_ssize_t nargs)
{
double x, rounded;
PyObject *o_ndigits = NULL;
@ -1048,9 +1048,6 @@ float_round(PyObject *v, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
if (!_PyArg_UnpackStack(args, nargs, "__round__", 0, 1, &o_ndigits))
return NULL;
if(!_PyArg_NoStackKeywords("__round__", kwnames))
return NULL;
if (o_ndigits == NULL || o_ndigits == Py_None) {
/* single-argument round or with None ndigits:
* round to nearest integer */
@ -1766,7 +1763,7 @@ float_getzero(PyObject *v, void *closure)
}
static PyObject *
float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *format_spec;
_PyUnicodeWriter writer;
@ -1775,9 +1772,6 @@ float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwn
if (!_PyArg_ParseStack(args, nargs, "U:__format__", &format_spec))
return NULL;
if(!_PyArg_NoStackKeywords("__format__", kwnames))
return NULL;
_PyUnicodeWriter_Init(&writer);
ret = _PyFloat_FormatAdvancedWriter(
&writer,