aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Include/abstract.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-12 07:53:52 +0300
committershadchin <shadchin@yandex-team.com>2024-02-12 08:07:36 +0300
commitce1b7ca3171f9158180640c6a02a74b4afffedea (patch)
treee47c1e8391b1b0128262c1e9b1e6ed4c8fff2348 /contrib/tools/python3/src/Include/abstract.h
parent57350d96f030db90f220ce50ee591d5c5d403df7 (diff)
downloadydb-ce1b7ca3171f9158180640c6a02a74b4afffedea.tar.gz
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Include/abstract.h')
-rw-r--r--contrib/tools/python3/src/Include/abstract.h42
1 files changed, 34 insertions, 8 deletions
diff --git a/contrib/tools/python3/src/Include/abstract.h b/contrib/tools/python3/src/Include/abstract.h
index 9e06fbbb74..064b0300b5 100644
--- a/contrib/tools/python3/src/Include/abstract.h
+++ b/contrib/tools/python3/src/Include/abstract.h
@@ -14,9 +14,9 @@ extern "C" {
Print an object 'o' on file 'fp'. Returns -1 on error. The flags argument
is used to enable certain printing options. The only option currently
- supported is Py_Print_RAW.
-
- (What should be said about Py_Print_RAW?). */
+ supported is Py_PRINT_RAW. By default (flags=0), PyObject_Print() formats
+ the object by calling PyObject_Repr(). If flags equals to Py_PRINT_RAW, it
+ formats the object by calling PyObject_Str(). */
/* Implemented elsewhere:
@@ -88,7 +88,7 @@ extern "C" {
-1 on failure.
This is the equivalent of the Python statement: del o.attr_name. */
-#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A), NULL)
+#define PyObject_DelAttrString(O, A) PyObject_SetAttrString((O), (A), NULL)
/* Implemented as a macro:
@@ -98,7 +98,7 @@ extern "C" {
Delete attribute named attr_name, for object o. Returns -1
on failure. This is the equivalent of the Python
statement: del o.attr_name. */
-#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A), NULL)
+#define PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)
/* Implemented elsewhere:
@@ -228,6 +228,32 @@ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(
PyObject *name,
...);
+/* Given a vectorcall nargsf argument, return the actual number of arguments.
+ * (For use outside the limited API, this is re-defined as a static inline
+ * function in cpython/abstract.h)
+ */
+PyAPI_FUNC(Py_ssize_t) PyVectorcall_NARGS(size_t nargsf);
+
+/* Call "callable" (which must support vectorcall) with positional arguments
+ "tuple" and keyword arguments "dict". "dict" may also be NULL */
+PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict);
+
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000
+#define PY_VECTORCALL_ARGUMENTS_OFFSET \
+ (_Py_STATIC_CAST(size_t, 1) << (8 * sizeof(size_t) - 1))
+
+/* Perform a PEP 590-style vector call on 'callable' */
+PyAPI_FUNC(PyObject *) PyObject_Vectorcall(
+ PyObject *callable,
+ PyObject *const *args,
+ size_t nargsf,
+ PyObject *kwnames);
+
+/* Call the method 'name' on args[0] with arguments in args[1..nargsf-1]. */
+PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod(
+ PyObject *name, PyObject *const *args,
+ size_t nargsf, PyObject *kwnames);
+#endif
/* Implemented elsewhere:
@@ -722,7 +748,7 @@ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
/* Return the 'i'-th element of the sequence 'o', assuming that o was returned
by PySequence_Fast, and that i is within bounds. */
#define PySequence_Fast_GET_ITEM(o, i)\
- (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
+ (PyList_Check(o) ? PyList_GET_ITEM((o), (i)) : PyTuple_GET_ITEM((o), (i)))
/* Return a pointer to the underlying item array for
an object returned by PySequence_Fast */
@@ -802,7 +828,7 @@ PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
failure.
This is equivalent to the Python statement: del o[key]. */
-#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K))
+#define PyMapping_DelItemString(O, K) PyObject_DelItemString((O), (K))
/* Implemented as a macro:
@@ -812,7 +838,7 @@ PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
Returns -1 on failure.
This is equivalent to the Python statement: del o[key]. */
-#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
+#define PyMapping_DelItem(O, K) PyObject_DelItem((O), (K))
/* On success, return 1 if the mapping object 'o' has the key 'key',
and 0 otherwise.