summaryrefslogtreecommitdiffstats
path: root/Objects/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-07-20 12:57:37 (GMT)
committerGitHub <noreply@github.com>2020-07-20 12:57:37 (GMT)
commit5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0 (patch)
treee984dc116ae6a1496282d81b108caa29f898ff78 /Objects/clinic
parent12f433411bba8a0cdc4f09ba34472745ae9da0d1 (diff)
downloadcpython-5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0.zip
cpython-5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0.tar.gz
cpython-5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0.tar.bz2
bpo-41342: Convert int.__round__ to Argument Clinic (GH-21549)
Diffstat (limited to 'Objects/clinic')
-rw-r--r--Objects/clinic/longobject.c.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h
index cf388c5..4bd47b1 100644
--- a/Objects/clinic/longobject.c.h
+++ b/Objects/clinic/longobject.c.h
@@ -87,6 +87,40 @@ exit:
return return_value;
}
+PyDoc_STRVAR(int___round____doc__,
+"__round__($self, ndigits=<unrepresentable>, /)\n"
+"--\n"
+"\n"
+"Rounding an Integral returns itself.\n"
+"\n"
+"Rounding with an ndigits argument also returns an integer.");
+
+#define INT___ROUND___METHODDEF \
+ {"__round__", (PyCFunction)(void(*)(void))int___round__, METH_FASTCALL, int___round____doc__},
+
+static PyObject *
+int___round___impl(PyObject *self, PyObject *o_ndigits);
+
+static PyObject *
+int___round__(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *o_ndigits = NULL;
+
+ if (!_PyArg_CheckPositional("__round__", nargs, 0, 1)) {
+ goto exit;
+ }
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ o_ndigits = args[0];
+skip_optional:
+ return_value = int___round___impl(self, o_ndigits);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(int___sizeof____doc__,
"__sizeof__($self, /)\n"
"--\n"
@@ -333,4 +367,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=4257cfdb155efd00 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ea18e51af5b53591 input=a9049054013a1b77]*/