aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Objects/enumobject.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-04-18 12:39:32 +0300
committershadchin <shadchin@yandex-team.ru>2022-04-18 12:39:32 +0300
commitd4be68e361f4258cf0848fc70018dfe37a2acc24 (patch)
tree153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/Objects/enumobject.c
parent260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff)
downloadydb-d4be68e361f4258cf0848fc70018dfe37a2acc24.tar.gz
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/Objects/enumobject.c')
-rw-r--r--contrib/tools/python3/src/Objects/enumobject.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/contrib/tools/python3/src/Objects/enumobject.c b/contrib/tools/python3/src/Objects/enumobject.c
index bdd0ea5f39..98ece3f13f 100644
--- a/contrib/tools/python3/src/Objects/enumobject.c
+++ b/contrib/tools/python3/src/Objects/enumobject.c
@@ -1,6 +1,7 @@
/* enumerate object */
#include "Python.h"
+#include "pycore_long.h" // _PyLong_GetOne()
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "clinic/enumobject.c.h"
@@ -116,7 +117,7 @@ enum_next_long(enumobject *en, PyObject* next_item)
}
next_index = en->en_longindex;
assert(next_index != NULL);
- stepped_up = PyNumber_Add(next_index, _PyLong_One);
+ stepped_up = PyNumber_Add(next_index, _PyLong_GetOne());
if (stepped_up == NULL) {
Py_DECREF(next_item);
return NULL;
@@ -325,6 +326,24 @@ reversed_new_impl(PyTypeObject *type, PyObject *seq)
return (PyObject *)ro;
}
+static PyObject *
+reversed_vectorcall(PyObject *type, PyObject * const*args,
+ size_t nargsf, PyObject *kwnames)
+{
+ assert(PyType_Check(type));
+
+ if (!_PyArg_NoKwnames("reversed", kwnames)) {
+ return NULL;
+ }
+
+ Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+ if (!_PyArg_CheckPositional("reversed", nargs, 1, 1)) {
+ return NULL;
+ }
+
+ return reversed_new_impl((PyTypeObject *)type, args[0]);
+}
+
static void
reversed_dealloc(reversedobject *ro)
{
@@ -456,4 +475,5 @@ PyTypeObject PyReversed_Type = {
PyType_GenericAlloc, /* tp_alloc */
reversed_new, /* tp_new */
PyObject_GC_Del, /* tp_free */
+ .tp_vectorcall = (vectorcallfunc)reversed_vectorcall,
};