@@ -138,9 +138,6 @@ extern "C" {
138
138
#ifdef PY_SSIZE_T_CLEAN
139
139
# define PyObject_CallFunction _PyObject_CallFunction_SizeT
140
140
# define PyObject_CallMethod _PyObject_CallMethod_SizeT
141
- # ifndef Py_LIMITED_API
142
- # define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
143
- # endif /* !Py_LIMITED_API */
144
141
#endif
145
142
146
143
@@ -155,123 +152,6 @@ extern "C" {
155
152
PyAPI_FUNC (PyObject * ) PyObject_Call (PyObject * callable ,
156
153
PyObject * args , PyObject * kwargs );
157
154
158
- #ifndef Py_LIMITED_API
159
- PyAPI_FUNC (PyObject * ) _PyStack_AsTuple (
160
- PyObject * const * stack ,
161
- Py_ssize_t nargs );
162
-
163
- PyAPI_FUNC (PyObject * ) _PyStack_AsTupleSlice (
164
- PyObject * const * stack ,
165
- Py_ssize_t nargs ,
166
- Py_ssize_t start ,
167
- Py_ssize_t end );
168
-
169
- /* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple)
170
- format to a Python dictionary ("kwargs" dict).
171
-
172
- The type of kwnames keys is not checked. The final function getting
173
- arguments is responsible to check if all keys are strings, for example using
174
- PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments().
175
-
176
- Duplicate keys are merged using the last value. If duplicate keys must raise
177
- an exception, the caller is responsible to implement an explicit keys on
178
- kwnames. */
179
- PyAPI_FUNC (PyObject * ) _PyStack_AsDict (
180
- PyObject * const * values ,
181
- PyObject * kwnames );
182
-
183
- /* Convert (args, nargs, kwargs: dict) into a (stack, nargs, kwnames: tuple).
184
-
185
- Return 0 on success, raise an exception and return -1 on error.
186
-
187
- Write the new stack into *p_stack. If *p_stack is differen than args, it
188
- must be released by PyMem_Free().
189
-
190
- The stack uses borrowed references.
191
-
192
- The type of keyword keys is not checked, these checks should be done
193
- later (ex: _PyArg_ParseStackAndKeywords). */
194
- PyAPI_FUNC (int ) _PyStack_UnpackDict (
195
- PyObject * const * args ,
196
- Py_ssize_t nargs ,
197
- PyObject * kwargs ,
198
- PyObject * const * * p_stack ,
199
- PyObject * * p_kwnames );
200
-
201
- /* Suggested size (number of positional arguments) for arrays of PyObject*
202
- allocated on a C stack to avoid allocating memory on the heap memory. Such
203
- array is used to pass positional arguments to call functions of the
204
- _PyObject_FastCall() family.
205
-
206
- The size is chosen to not abuse the C stack and so limit the risk of stack
207
- overflow. The size is also chosen to allow using the small stack for most
208
- function calls of the Python standard library. On 64-bit CPU, it allocates
209
- 40 bytes on the stack. */
210
- #define _PY_FASTCALL_SMALL_STACK 5
211
-
212
- /* Return 1 if callable supports FASTCALL calling convention for positional
213
- arguments: see _PyObject_FastCallDict() and _PyObject_FastCallKeywords() */
214
- PyAPI_FUNC (int ) _PyObject_HasFastCall (PyObject * callable );
215
-
216
- /* Call the callable object 'callable' with the "fast call" calling convention:
217
- args is a C array for positional arguments (nargs is the number of
218
- positional arguments), kwargs is a dictionary for keyword arguments.
219
-
220
- If nargs is equal to zero, args can be NULL. kwargs can be NULL.
221
- nargs must be greater or equal to zero.
222
-
223
- Return the result on success. Raise an exception on return NULL on
224
- error. */
225
- PyAPI_FUNC (PyObject * ) _PyObject_FastCallDict (
226
- PyObject * callable ,
227
- PyObject * const * args ,
228
- Py_ssize_t nargs ,
229
- PyObject * kwargs );
230
-
231
- /* Call the callable object 'callable' with the "fast call" calling convention:
232
- args is a C array for positional arguments followed by values of
233
- keyword arguments. Keys of keyword arguments are stored as a tuple
234
- of strings in kwnames. nargs is the number of positional parameters at
235
- the beginning of stack. The size of kwnames gives the number of keyword
236
- values in the stack after positional arguments.
237
-
238
- kwnames must only contains str strings, no subclass, and all keys must
239
- be unique.
240
-
241
- If nargs is equal to zero and there is no keyword argument (kwnames is
242
- NULL or its size is zero), args can be NULL.
243
-
244
- Return the result on success. Raise an exception and return NULL on
245
- error. */
246
- PyAPI_FUNC (PyObject * ) _PyObject_FastCallKeywords (
247
- PyObject * callable ,
248
- PyObject * const * args ,
249
- Py_ssize_t nargs ,
250
- PyObject * kwnames );
251
-
252
- #define _PyObject_FastCall (func , args , nargs ) \
253
- _PyObject_FastCallDict((func), (args), (nargs), NULL)
254
-
255
- #define _PyObject_CallNoArg (func ) \
256
- _PyObject_FastCallDict((func), NULL, 0, NULL)
257
-
258
- PyAPI_FUNC (PyObject * ) _PyObject_Call_Prepend (
259
- PyObject * callable ,
260
- PyObject * obj ,
261
- PyObject * args ,
262
- PyObject * kwargs );
263
-
264
- PyAPI_FUNC (PyObject * ) _PyObject_FastCall_Prepend (
265
- PyObject * callable ,
266
- PyObject * obj ,
267
- PyObject * const * args ,
268
- Py_ssize_t nargs );
269
-
270
- PyAPI_FUNC (PyObject * ) _Py_CheckFunctionResult (PyObject * callable ,
271
- PyObject * result ,
272
- const char * where );
273
- #endif /* Py_LIMITED_API */
274
-
275
155
276
156
/* Call a callable Python object 'callable', with arguments given by the
277
157
tuple 'args'. If no arguments are needed, then 'args' can be *NULL*.
@@ -309,14 +189,6 @@ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
309
189
const char * name ,
310
190
const char * format , ...);
311
191
312
- #ifndef Py_LIMITED_API
313
- /* Like PyObject_CallMethod(), but expect a _Py_Identifier*
314
- as the method name. */
315
- PyAPI_FUNC (PyObject * ) _PyObject_CallMethodId (PyObject * obj ,
316
- _Py_Identifier * name ,
317
- const char * format , ...);
318
- #endif /* !Py_LIMITED_API */
319
-
320
192
PyAPI_FUNC (PyObject * ) _PyObject_CallFunction_SizeT (PyObject * callable ,
321
193
const char * format ,
322
194
...);
@@ -326,13 +198,6 @@ PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj,
326
198
const char * format ,
327
199
...);
328
200
329
- #ifndef Py_LIMITED_API
330
- PyAPI_FUNC (PyObject * ) _PyObject_CallMethodId_SizeT (PyObject * obj ,
331
- _Py_Identifier * name ,
332
- const char * format ,
333
- ...);
334
- #endif /* !Py_LIMITED_API */
335
-
336
201
/* Call a callable Python object 'callable' with a variable number of C
337
202
arguments. The C arguments are provided as PyObject* values, terminated
338
203
by a NULL.
@@ -357,13 +222,6 @@ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(
357
222
PyObject * name ,
358
223
...);
359
224
360
- #ifndef Py_LIMITED_API
361
- PyAPI_FUNC (PyObject * ) _PyObject_CallMethodIdObjArgs (
362
- PyObject * obj ,
363
- struct _Py_Identifier * name ,
364
- ...);
365
- #endif /* !Py_LIMITED_API */
366
-
367
225
368
226
/* Implemented elsewhere:
369
227
@@ -418,16 +276,6 @@ PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o);
418
276
PyAPI_FUNC (Py_ssize_t ) PyObject_Length (PyObject * o );
419
277
#define PyObject_Length PyObject_Size
420
278
421
-
422
- #ifndef Py_LIMITED_API
423
- PyAPI_FUNC (int ) _PyObject_HasLen (PyObject * o );
424
-
425
- /* Guess the size of object 'o' using len(o) or o.__length_hint__().
426
- If neither of those return a non-negative value, then return the default
427
- value. If one of the calls fails, this function returns -1. */
428
- PyAPI_FUNC (Py_ssize_t ) PyObject_LengthHint (PyObject * o , Py_ssize_t );
429
- #endif
430
-
431
279
/* Return element of 'o' corresponding to the object 'key'. Return NULL
432
280
on failure.
433
281
@@ -505,78 +353,6 @@ PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
505
353
506
354
/* === New Buffer API ============================================ */
507
355
508
- #ifndef Py_LIMITED_API
509
-
510
- /* Return 1 if the getbuffer function is available, otherwise return 0. */
511
- #define PyObject_CheckBuffer (obj ) \
512
- (((obj)->ob_type->tp_as_buffer != NULL) && \
513
- ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
514
-
515
- /* This is a C-API version of the getbuffer function call. It checks
516
- to make sure object has the required function pointer and issues the
517
- call.
518
-
519
- Returns -1 and raises an error on failure and returns 0 on success. */
520
- PyAPI_FUNC (int ) PyObject_GetBuffer (PyObject * obj , Py_buffer * view ,
521
- int flags );
522
-
523
- /* Get the memory area pointed to by the indices for the buffer given.
524
- Note that view->ndim is the assumed size of indices. */
525
- PyAPI_FUNC (void * ) PyBuffer_GetPointer (Py_buffer * view , Py_ssize_t * indices );
526
-
527
- /* Return the implied itemsize of the data-format area from a
528
- struct-style description. */
529
- PyAPI_FUNC (int ) PyBuffer_SizeFromFormat (const char * );
530
-
531
- /* Implementation in memoryobject.c */
532
- PyAPI_FUNC (int ) PyBuffer_ToContiguous (void * buf , Py_buffer * view ,
533
- Py_ssize_t len , char order );
534
-
535
- PyAPI_FUNC (int ) PyBuffer_FromContiguous (Py_buffer * view , void * buf ,
536
- Py_ssize_t len , char order );
537
-
538
- /* Copy len bytes of data from the contiguous chunk of memory
539
- pointed to by buf into the buffer exported by obj. Return
540
- 0 on success and return -1 and raise a PyBuffer_Error on
541
- error (i.e. the object does not have a buffer interface or
542
- it is not working).
543
-
544
- If fort is 'F', then if the object is multi-dimensional,
545
- then the data will be copied into the array in
546
- Fortran-style (first dimension varies the fastest). If
547
- fort is 'C', then the data will be copied into the array
548
- in C-style (last dimension varies the fastest). If fort
549
- is 'A', then it does not matter and the copy will be made
550
- in whatever way is more efficient. */
551
- PyAPI_FUNC (int ) PyObject_CopyData (PyObject * dest , PyObject * src );
552
-
553
- /* Copy the data from the src buffer to the buffer of destination. */
554
- PyAPI_FUNC (int ) PyBuffer_IsContiguous (const Py_buffer * view , char fort );
555
-
556
- /*Fill the strides array with byte-strides of a contiguous
557
- (Fortran-style if fort is 'F' or C-style otherwise)
558
- array of the given shape with the given number of bytes
559
- per element. */
560
- PyAPI_FUNC (void ) PyBuffer_FillContiguousStrides (int ndims ,
561
- Py_ssize_t * shape ,
562
- Py_ssize_t * strides ,
563
- int itemsize ,
564
- char fort );
565
-
566
- /* Fills in a buffer-info structure correctly for an exporter
567
- that can only share a contiguous chunk of memory of
568
- "unsigned bytes" of the given length.
569
-
570
- Returns 0 on success and -1 (with raising an error) on error. */
571
- PyAPI_FUNC (int ) PyBuffer_FillInfo (Py_buffer * view , PyObject * o , void * buf ,
572
- Py_ssize_t len , int readonly ,
573
- int flags );
574
-
575
- /* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */
576
- PyAPI_FUNC (void ) PyBuffer_Release (Py_buffer * view );
577
-
578
- #endif /* Py_LIMITED_API */
579
-
580
356
/* Takes an arbitrary object and returns the result of calling
581
357
obj.__format__(format_spec). */
582
358
PyAPI_FUNC (PyObject * ) PyObject_Format (PyObject * obj ,
@@ -594,11 +370,6 @@ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
594
370
595
371
This function always succeeds. */
596
372
PyAPI_FUNC (int ) PyIter_Check (PyObject * );
597
- #ifndef Py_LIMITED_API
598
- #define PyIter_Check (obj ) \
599
- ((obj)->ob_type->tp_iternext != NULL && \
600
- (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
601
- #endif
602
373
603
374
/* Takes an iterator object and calls its tp_iternext slot,
604
375
returning the next value.
@@ -719,11 +490,6 @@ PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);
719
490
/* Returns 1 if obj is an index integer (has the nb_index slot of the
720
491
tp_as_number structure filled in), and 0 otherwise. */
721
492
PyAPI_FUNC (int ) PyIndex_Check (PyObject * );
722
- #ifndef Py_LIMITED_API
723
- #define PyIndex_Check (obj ) \
724
- ((obj)->ob_type->tp_as_number != NULL && \
725
- (obj)->ob_type->tp_as_number->nb_index != NULL)
726
- #endif
727
493
728
494
/* Returns the object 'o' converted to a Python int, or NULL with an exception
729
495
raised on failure. */
@@ -930,13 +696,6 @@ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
930
696
#define PySequence_Fast_GET_ITEM (o , i )\
931
697
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
932
698
933
- /* Assume tp_as_sequence and sq_item exist and that 'i' does not
934
- need to be corrected for a negative index. */
935
- #ifndef Py_LIMITED_API
936
- #define PySequence_ITEM (o , i )\
937
- ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
938
- #endif
939
-
940
699
/* Return a pointer to the underlying item array for
941
700
an object retured by PySequence_Fast */
942
701
#define PySequence_Fast_ITEMS (sf ) \
@@ -956,27 +715,6 @@ PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value);
956
715
Use __contains__ if possible, else _PySequence_IterSearch(). */
957
716
PyAPI_FUNC (int ) PySequence_Contains (PyObject * seq , PyObject * ob );
958
717
959
- #ifndef Py_LIMITED_API
960
- #define PY_ITERSEARCH_COUNT 1
961
- #define PY_ITERSEARCH_INDEX 2
962
- #define PY_ITERSEARCH_CONTAINS 3
963
-
964
- /* Iterate over seq.
965
-
966
- Result depends on the operation:
967
-
968
- PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
969
- error.
970
- PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of
971
- obj in seq; set ValueError and return -1 if none found;
972
- also return -1 on error.
973
- PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on
974
- error. */
975
- PyAPI_FUNC (Py_ssize_t ) _PySequence_IterSearch (PyObject * seq ,
976
- PyObject * obj , int operation );
977
- #endif
978
-
979
-
980
718
/* For DLL-level backwards compatibility */
981
719
#undef PySequence_In
982
720
/* Determine if the sequence 'o' contains 'value'. If an item in 'o' is equal
@@ -1095,26 +833,11 @@ PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass);
1095
833
/* issubclass(object, typeorclass) */
1096
834
PyAPI_FUNC (int ) PyObject_IsSubclass (PyObject * object , PyObject * typeorclass );
1097
835
1098
-
1099
836
#ifndef Py_LIMITED_API
1100
- PyAPI_FUNC (int ) _PyObject_RealIsInstance (PyObject * inst , PyObject * cls );
1101
-
1102
- PyAPI_FUNC (int ) _PyObject_RealIsSubclass (PyObject * derived , PyObject * cls );
1103
-
1104
- PyAPI_FUNC (char * const * ) _PySequence_BytesToCharpArray (PyObject * self );
1105
-
1106
- PyAPI_FUNC (void ) _Py_FreeCharPArray (char * const array []);
1107
-
1108
- /* For internal use by buffer API functions */
1109
- PyAPI_FUNC (void ) _Py_add_one_to_index_F (int nd , Py_ssize_t * index ,
1110
- const Py_ssize_t * shape );
1111
- PyAPI_FUNC (void ) _Py_add_one_to_index_C (int nd , Py_ssize_t * index ,
1112
- const Py_ssize_t * shape );
1113
-
1114
- /* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */
1115
- PyAPI_FUNC (int ) _Py_convert_optional_to_ssize_t (PyObject * , void * );
1116
- #endif /* !Py_LIMITED_API */
1117
-
837
+ # define Py_CPYTHON_ABSTRACTOBJECT_H
838
+ # include "cpython/abstract.h"
839
+ # undef Py_CPYTHON_ABSTRACTOBJECT_H
840
+ #endif
1118
841
1119
842
#ifdef __cplusplus
1120
843
}
0 commit comments