@@ -14,9 +14,9 @@ extern "C" {
14
14
15
15
Print an object 'o' on file 'fp'. Returns -1 on error. The flags argument
16
16
is used to enable certain printing options. The only option currently
17
- supported is Py_Print_RAW.
18
-
19
- (What should be said about Py_Print_RAW? ). */
17
+ supported is Py_PRINT_RAW. By default (flags=0), PyObject_Print() formats
18
+ the object by calling PyObject_Repr(). If flags equals to Py_PRINT_RAW, it
19
+ formats the object by calling PyObject_Str( ). */
20
20
21
21
22
22
/* Implemented elsewhere:
@@ -88,7 +88,7 @@ extern "C" {
88
88
-1 on failure.
89
89
90
90
This is the equivalent of the Python statement: del o.attr_name. */
91
- #define PyObject_DelAttrString (O ,A ) PyObject_SetAttrString((O),(A), NULL)
91
+ #define PyObject_DelAttrString (O , A ) PyObject_SetAttrString((O), (A), NULL)
92
92
93
93
94
94
/* Implemented as a macro:
@@ -98,7 +98,7 @@ extern "C" {
98
98
Delete attribute named attr_name, for object o. Returns -1
99
99
on failure. This is the equivalent of the Python
100
100
statement: del o.attr_name. */
101
- #define PyObject_DelAttr (O ,A ) PyObject_SetAttr((O),(A), NULL)
101
+ #define PyObject_DelAttr (O , A ) PyObject_SetAttr((O), (A), NULL)
102
102
103
103
104
104
/* Implemented elsewhere:
@@ -228,6 +228,32 @@ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(
228
228
PyObject * name ,
229
229
...);
230
230
231
+ /* Given a vectorcall nargsf argument, return the actual number of arguments.
232
+ * (For use outside the limited API, this is re-defined as a static inline
233
+ * function in cpython/abstract.h)
234
+ */
235
+ PyAPI_FUNC (Py_ssize_t ) PyVectorcall_NARGS (size_t nargsf );
236
+
237
+ /* Call "callable" (which must support vectorcall) with positional arguments
238
+ "tuple" and keyword arguments "dict". "dict" may also be NULL */
239
+ PyAPI_FUNC (PyObject * ) PyVectorcall_Call (PyObject * callable , PyObject * tuple , PyObject * dict );
240
+
241
+ #if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x030C0000
242
+ #define PY_VECTORCALL_ARGUMENTS_OFFSET \
243
+ (_Py_STATIC_CAST(size_t, 1) << (8 * sizeof(size_t) - 1))
244
+
245
+ /* Perform a PEP 590-style vector call on 'callable' */
246
+ PyAPI_FUNC (PyObject * ) PyObject_Vectorcall (
247
+ PyObject * callable ,
248
+ PyObject * const * args ,
249
+ size_t nargsf ,
250
+ PyObject * kwnames );
251
+
252
+ /* Call the method 'name' on args[0] with arguments in args[1..nargsf-1]. */
253
+ PyAPI_FUNC (PyObject * ) PyObject_VectorcallMethod (
254
+ PyObject * name , PyObject * const * args ,
255
+ size_t nargsf , PyObject * kwnames );
256
+ #endif
231
257
232
258
/* Implemented elsewhere:
233
259
@@ -722,7 +748,7 @@ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
722
748
/* Return the 'i'-th element of the sequence 'o', assuming that o was returned
723
749
by PySequence_Fast, and that i is within bounds. */
724
750
#define PySequence_Fast_GET_ITEM (o , i )\
725
- (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i ))
751
+ (PyList_Check(o) ? PyList_GET_ITEM((o), (i)) : PyTuple_GET_ITEM((o), (i) ))
726
752
727
753
/* Return a pointer to the underlying item array for
728
754
an object returned by PySequence_Fast */
@@ -802,7 +828,7 @@ PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
802
828
failure.
803
829
804
830
This is equivalent to the Python statement: del o[key]. */
805
- #define PyMapping_DelItemString (O ,K ) PyObject_DelItemString((O),(K))
831
+ #define PyMapping_DelItemString (O , K ) PyObject_DelItemString((O), (K))
806
832
807
833
/* Implemented as a macro:
808
834
@@ -812,7 +838,7 @@ PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
812
838
Returns -1 on failure.
813
839
814
840
This is equivalent to the Python statement: del o[key]. */
815
- #define PyMapping_DelItem (O ,K ) PyObject_DelItem((O),(K))
841
+ #define PyMapping_DelItem (O , K ) PyObject_DelItem((O), (K))
816
842
817
843
/* On success, return 1 if the mapping object 'o' has the key 'key',
818
844
and 0 otherwise.
0 commit comments