diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-19 06:51:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-19 06:51:07 (GMT) |
commit | 18b250f844bf8b2d1a81c2d2dcc74e850364fe35 (patch) | |
tree | 117c9240b5b87067a07cb43bc9260ed26c3148bb /Objects/longobject.c | |
parent | 0b5615926a573c19c887a701a2f7047f4fd06de6 (diff) | |
download | cpython-18b250f844bf8b2d1a81c2d2dcc74e850364fe35.zip cpython-18b250f844bf8b2d1a81c2d2dcc74e850364fe35.tar.gz cpython-18b250f844bf8b2d1a81c2d2dcc74e850364fe35.tar.bz2 |
bpo-29793: Convert some builtin types constructors to Argument Clinic. (#615)
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 95661a4..0bf6ae6 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4789,20 +4789,24 @@ long_float(PyObject *v) } static PyObject * -long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); +long_subtype_new(PyTypeObject *type, PyObject *x, PyObject *obase); + +/*[clinic input] +@classmethod +int.__new__ as long_new + x: object(c_default="NULL") = 0 + / + base as obase: object(c_default="NULL") = 10 +[clinic start generated code]*/ static PyObject * -long_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +long_new_impl(PyTypeObject *type, PyObject *x, PyObject *obase) +/*[clinic end generated code: output=e47cfe777ab0f24c input=81c98f418af9eb6f]*/ { - PyObject *obase = NULL, *x = NULL; Py_ssize_t base; - static char *kwlist[] = {"", "base", 0}; if (type != &PyLong_Type) - return long_subtype_new(type, args, kwds); /* Wimp out */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO:int", kwlist, - &x, &obase)) - return NULL; + return long_subtype_new(type, x, obase); /* Wimp out */ if (x == NULL) { if (obase != NULL) { PyErr_SetString(PyExc_TypeError, @@ -4846,13 +4850,13 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds) the regular int. The regular int is then thrown away. */ static PyObject * -long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +long_subtype_new(PyTypeObject *type, PyObject *x, PyObject *obase) { PyLongObject *tmp, *newobj; Py_ssize_t i, n; assert(PyType_IsSubtype(type, &PyLong_Type)); - tmp = (PyLongObject *)long_new(&PyLong_Type, args, kwds); + tmp = (PyLongObject *)long_new_impl(&PyLong_Type, x, obase); if (tmp == NULL) return NULL; assert(PyLong_Check(tmp)); |