Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / cython / src / Cython / Includes / Deprecated / python2.5.pxd
blobf9a25c62788decee44da577559fe4229146c672f
1 # From: Eric Huss <e-huss@netmeridian.com>
3 # Here is my latest copy.  It does not cover 100% of the API.  It should be
4 # current up to 2.5.
6 # -Eric
11 # XXX:
12 # - Need to support "long long" definitions that are different for different platforms.
13 # - Support unicode platform dependencies.
14 # - Add unicode calls.
15 # - Add setobject calls.
17 cdef extern from "stdio.h":
18     ctypedef struct FILE:
19         pass
21 cdef extern from "Python.h":
23     # XXX: This is platform dependent.
24     ctypedef unsigned short Py_UNICODE
26     ctypedef struct PyTypeObject:
27         pass
29     ctypedef struct PyObject:
30         Py_ssize_t ob_refcnt
31         PyTypeObject * ob_type
33     ###############################################################################################
34     # bool
35     ###############################################################################################
36     PyObject * Py_False
37     PyObject * Py_True
38     PyTypeObject PyBool_Type
39     int                 PyBool_Check                    (object)                    # Always succeeds.
40     object              PyBool_FromLong                 (long)
42     ###############################################################################################
43     # buffer
44     ###############################################################################################
45     PyTypeObject PyBuffer_Type
46     int Py_END_OF_BUFFER
47     int                 PyBuffer_Check                  (object)                    # Always succeeds.
48     object              PyBuffer_FromMemory             (void *, Py_ssize_t)
49     object              PyBuffer_FromObject             (object, Py_ssize_t, Py_ssize_t)
50     object              PyBuffer_FromReadWriteMemory    (void *, Py_ssize_t)
51     object              PyBuffer_FromReadWriteObject    (object, Py_ssize_t, Py_ssize_t)
52     object              PyBuffer_New                    (Py_ssize_t)
53     int                 PyObject_AsCharBuffer           (object, char **, Py_ssize_t *)    except -1
54     int                 PyObject_AsReadBuffer           (object, void **, Py_ssize_t *)    except -1
55     int                 PyObject_AsWriteBuffer          (object, void **, Py_ssize_t *)    except -1
56     int                 PyObject_CheckReadBuffer        (object)                    # Always succeeds.
58     ###############################################################################################
59     # cobject
60     ###############################################################################################
61     PyTypeObject PyCObject_Type
63     int                 PyCObject_Check(object)                                     # Always succeeds.
64     object              PyCObject_FromVoidPtr(void *, void (*)(void*))
65     object              PyCObject_FromVoidPtrAndDesc(void *, void *, void (*)(void*,void*))
66     void *              PyCObject_AsVoidPtr(object)                                 except NULL
67     void *              PyCObject_GetDesc(object)                                   except NULL
68     void *              PyCObject_Import(char *, char *)                            except NULL
70     ###############################################################################################
71     # compile
72     ###############################################################################################
74     ctypedef struct PyCodeObject:
75         int       co_argcount
76         int       co_nlocals
77         int       co_stacksize
78         int       co_flags
79         PyObject *co_code
80         PyObject *co_consts
81         PyObject *co_names
82         PyObject *co_varnames
83         PyObject *co_freevars
84         PyObject *co_cellvars
85         PyObject *co_filename
86         PyObject *co_name
87         int       co_firstlineno
88         PyObject *co_lnotab
90     int PyCode_Addr2Line(PyCodeObject *, int)
92     ###############################################################################################
93     # complex
94     ###############################################################################################
95     ctypedef struct Py_complex:
96         double real
97         double imag
99     PyTypeObject PyComplex_Type
101     Py_complex          PyComplex_AsCComplex            (object)                    # Always succeeds.
102     int                 PyComplex_Check                 (object)                    # Always succeeds.
103     int                 PyComplex_CheckExact            (object)                    # Always succeeds.
104     object              PyComplex_FromCComplex          (Py_complex)
105     object              PyComplex_FromDoubles           (double, double)
106     double              PyComplex_ImagAsDouble          (object)                    except? -1
107     double              PyComplex_RealAsDouble          (object)                    except? -1
108     Py_complex          _Py_c_diff                      (Py_complex, Py_complex)
109     Py_complex          _Py_c_neg                       (Py_complex)
110     Py_complex          _Py_c_pow                       (Py_complex, Py_complex)
111     Py_complex          _Py_c_prod                      (Py_complex, Py_complex)
112     Py_complex          _Py_c_quot                      (Py_complex, Py_complex)
113     Py_complex          _Py_c_sum                       (Py_complex, Py_complex)
115     ###############################################################################################
116     # dict
117     ###############################################################################################
118     PyTypeObject PyDict_Type
120     int                 PyDict_Check                    (object)                    # Always succeeds.
121     int                 PyDict_CheckExact               (object)                    # Always succeeds.
122     void                PyDict_Clear                    (object)
123     int                 PyDict_Contains                 (object, object)            except -1
124     object              PyDict_Copy                     (object)
125     int                 PyDict_DelItem                  (object, object)            except -1
126     int                 PyDict_DelItemString            (object, char *)            except -1
127     object              PyDict_Items                    (object)
128     object              PyDict_Keys                     (object)
129     int                 PyDict_Merge                    (object, object, int)       except -1
130     int                 PyDict_MergeFromSeq2            (object, object, int)       except -1
131     object              PyDict_New                      ()
132     # XXX: Pyrex doesn't support pointer to a python object?
133     #int                 PyDict_Next                     (object, Py_ssize_t *, object *, object *) # Always succeeds.
134     int                 PyDict_SetItem                  (object, object, object)    except -1
135     int                 PyDict_SetItemString            (object, char *, object)    except -1
136     Py_ssize_t          PyDict_Size                     (object)                    except -1
137     int                 PyDict_Update                   (object, object)            except -1
138     object              PyDict_Values                   (object)
139     # XXX: Borrowed reference.  No exception on NULL.
140     #object              PyDict_GetItem                  (object, object)
141     # XXX: Borrowed reference.  No exception on NULL
142     #object              PyDict_GetItemString            (object, char *)
145     ###############################################################################################
146     # float
147     ###############################################################################################
148     PyTypeObject PyFloat_Type
149     int                 _PyFloat_Pack4                  (double, unsigned char *, int)  except -1
150     int                 _PyFloat_Pack8                  (double, unsigned char *, int)  except -1
151     double              _PyFloat_Unpack4                (unsigned char *, int)      except? -1
152     double              _PyFloat_Unpack8                (unsigned char *, int)      except? -1
153     double              PyFloat_AS_DOUBLE               (object)
154     double              PyFloat_AsDouble                (object)                    except? -1
155     void                PyFloat_AsReprString            (char*, object)
156     void                PyFloat_AsString                (char*, object)
157     int                 PyFloat_Check                   (object)                    # Always succeeds.
158     int                 PyFloat_CheckExact              (object)                    # Always succeeds.
159     object              PyFloat_FromDouble              (double)
160     object              PyFloat_FromString              (object, char**)
162     ###############################################################################################
163     # frame
164     ###############################################################################################
166     ctypedef struct PyFrameObject:
167         PyFrameObject *f_back
168         PyCodeObject  *f_code
169         PyObject *f_builtins
170         PyObject *f_globals
171         PyObject *f_locals
172         PyObject *f_trace
173         PyObject *f_exc_type
174         PyObject *f_exc_value
175         PyObject *f_exc_traceback
176         int f_lasti
177         int f_lineno
178         int f_restricted
179         int f_iblock
180         int f_nlocals
181         int f_ncells
182         int f_nfreevars
183         int f_stacksize
185     ###############################################################################################
186     # int
187     ###############################################################################################
188     PyTypeObject PyInt_Type
189     long                PyInt_AS_LONG                   (object)                    # Always succeeds.
190     long                PyInt_AsLong                    (object)                    except? -1
191     Py_ssize_t          PyInt_AsSsize_t                 (object)                    except? -1
192     unsigned long long  PyInt_AsUnsignedLongLongMask    (object)                    except? -1
193     unsigned long       PyInt_AsUnsignedLongMask        (object)                    except? -1
194     int                 PyInt_Check                     (object)                    # Always succeeds.
195     int                 PyInt_CheckExact                (object)                    # Always succeeds.
196     object              PyInt_FromLong                  (long)
197     object              PyInt_FromSsize_t               (Py_ssize_t)
198     object              PyInt_FromString                (char*, char**, int)
199     object              PyInt_FromUnicode               (Py_UNICODE*, Py_ssize_t, int)
200     long                PyInt_GetMax                    ()                      # Always succeeds.
202     ###############################################################################################
203     # iterator
204     ###############################################################################################
205     int                 PyIter_Check                    (object)                    # Always succeeds.
206     object              PyIter_Next                     (object)
208     ###############################################################################################
209     # list
210     ###############################################################################################
211     PyTypeObject PyList_Type
212     int                 PyList_Append                   (object, object)            except -1
213     object              PyList_AsTuple                  (object)
214     int                 PyList_Check                    (object)                    # Always succeeds.
215     int                 PyList_CheckExact               (object)                    # Always succeeds.
216     int                 PyList_GET_SIZE                 (object)                    # Always suceeds.
217     object              PyList_GetSlice                 (object, Py_ssize_t, Py_ssize_t)
218     int                 PyList_Insert                   (object, Py_ssize_t, object)       except -1
219     object              PyList_New                      (Py_ssize_t)
220     int                 PyList_Reverse                  (object)                    except -1
221     int                 PyList_SetSlice                 (object, Py_ssize_t, Py_ssize_t, object)  except -1
222     Py_ssize_t          PyList_Size                     (object)                    except -1
223     int                 PyList_Sort                     (object)                    except -1
225     ###############################################################################################
226     # long
227     ###############################################################################################
228     PyTypeObject PyLong_Type
229     int                 _PyLong_AsByteArray             (object, unsigned char *, size_t, int, int) except -1
230     object              _PyLong_FromByteArray           (unsigned char *, size_t, int, int)
231     size_t              _PyLong_NumBits                 (object)                    except -1
232     int                 _PyLong_Sign                    (object)                    # No error.
233     long                PyLong_AsLong                   (object)                    except? -1
234     long long           PyLong_AsLongLong               (object)                    except? -1
235     unsigned long       PyLong_AsUnsignedLong           (object)                    except? -1
236     unsigned long       PyLong_AsUnsignedLongMask       (object)                    except? -1
237     unsigned long long  PyLong_AsUnsignedLongLong       (object)                    except? -1
238     unsigned long long  PyLong_AsUnsignedLongLongMask   (object)                    except? -1
239     int                 PyLong_Check                    (object)                    # Always succeeds.
240     int                 PyLong_CheckExact               (object)                    # Always succeeds.
241     object              PyLong_FromDouble               (double)
242     object              PyLong_FromLong                 (long)
243     object              PyLong_FromLongLong             (long long)
244     object              PyLong_FromUnsignedLong         (unsigned long)
245     object              PyLong_FromUnsignedLongLong     (unsigned long long)
246     double              PyLong_AsDouble                 (object)                    except? -1
247     object              PyLong_FromVoidPtr              (void *)
248     void *              PyLong_AsVoidPtr                (object)                    except NULL
249     object              PyLong_FromString               (char *, char **, int)
250     object              PyLong_FromUnicode              (Py_UNICODE*, Py_ssize_t, int)
252     ###############################################################################################
253     # mapping
254     ###############################################################################################
255     int                 PyMapping_Check                 (object)                    # Always succeeds.
256     int                 PyMapping_DelItem               (object, object)            except -1
257     int                 PyMapping_DelItemString         (object, char *)            except -1
258     object              PyMapping_GetItemString         (object, char *)
259     int                 PyMapping_HasKey                (object, object)            # Always succeeds.
260     int                 PyMapping_HasKeyString          (object, char *)            # Always succeeds.
261     object              PyMapping_Items                 (object)
262     object              PyMapping_Keys                  (object)
263     Py_ssize_t          PyMapping_Length                (object)                    except -1
264     int                 PyMapping_SetItemString         (object, char *, object)    except -1
265     Py_ssize_t          PyMapping_Size                  (object)                    except -1
266     object              PyMapping_Values                (object)
268     ###############################################################################################
269     # mem
270     ###############################################################################################
271     void                PyMem_Free                      (void * p)
272     void *              PyMem_Malloc                    (size_t n)
273     void *              PyMem_Realloc                   (void *, size_t)
275     ###############################################################################################
276     # modsupport
277     ###############################################################################################
278     object              Py_BuildValue                   (char *, ...)
279     object              Py_VaBuildValue                 (char *, va_list)
281     ###############################################################################################
282     # number
283     ###############################################################################################
284     object              PyNumber_Absolute               (object)
285     object              PyNumber_Add                    (object, object)
286     object              PyNumber_And                    (object, object)
287     Py_ssize_t          PyNumber_AsSsize_t              (object, object)    except? -1
288     int                 PyNumber_Check                  (object)                    # Always succeeds.
289     # XXX: Pyrex doesn't support pointer to python object?
290     #int                 PyNumber_Coerce                 (object*, object*)          except -1
291     object              PyNumber_Divide                 (object, object)
292     object              PyNumber_Divmod                 (object, object)
293     object              PyNumber_Float                  (object)
294     object              PyNumber_FloorDivide            (object, object)
295     object              PyNumber_InPlaceAdd             (object, object)
296     object              PyNumber_InPlaceAnd             (object, object)
297     object              PyNumber_InPlaceDivide          (object, object)
298     object              PyNumber_InPlaceFloorDivide     (object, object)
299     object              PyNumber_InPlaceLshift          (object, object)
300     object              PyNumber_InPlaceMultiply        (object, object)
301     object              PyNumber_InPlaceOr              (object, object)
302     object              PyNumber_InPlacePower           (object, object, object)
303     object              PyNumber_InPlaceRemainder       (object, object)
304     object              PyNumber_InPlaceRshift          (object, object)
305     object              PyNumber_InPlaceSubtract        (object, object)
306     object              PyNumber_InPlaceTrueDivide      (object, object)
307     object              PyNumber_InPlaceXor             (object, object)
308     object              PyNumber_Int                    (object)
309     object              PyNumber_Invert                 (object)
310     object              PyNumber_Long                   (object)
311     object              PyNumber_Lshift                 (object, object)
312     object              PyNumber_Multiply               (object, object)
313     object              PyNumber_Negative               (object)
314     object              PyNumber_Or                     (object, object)
315     object              PyNumber_Positive               (object)
316     object              PyNumber_Power                  (object, object, object)
317     object              PyNumber_Remainder              (object, object)
318     object              PyNumber_Rshift                 (object, object)
319     object              PyNumber_Subtract               (object, object)
320     object              PyNumber_TrueDivide             (object, object)
321     object              PyNumber_Xor                    (object, object)
323     ###############################################################################################
324     # object
325     ###############################################################################################
326     int                 PyCallable_Check                (object)                    # Always succeeds.
327     int                 PyObject_AsFileDescriptor       (object)                    except -1
328     object              PyObject_Call                   (object, object, object)
329     object              PyObject_CallFunction           (object, char *, ...)
330     object              PyObject_CallFunctionObjArgs    (object, ...)
331     object              PyObject_CallMethod             (object, char *, char *, ...)
332     object              PyObject_CallMethodObjArgs      (object, object, ...)
333     object              PyObject_CallObject             (object, object)
334     int                 PyObject_Cmp                    (object, object, int *result)   except -1
335     # Use PyObject_Cmp instead.
336     #int                 PyObject_Compare                (object, object)
337     int                 PyObject_DelAttr                (object, object)            except -1
338     int                 PyObject_DelAttrString          (object, char *)            except -1
339     int                 PyObject_DelItem                (object, object)            except -1
340     int                 PyObject_DelItemString          (object, char *)            except -1
341     object              PyObject_Dir                    (object)
342     object              PyObject_GetAttr                (object, object)
343     object              PyObject_GetAttrString          (object, char *)
344     object              PyObject_GetItem                (object, object)
345     object              PyObject_GetIter                (object)
346     int                 PyObject_HasAttr                (object, object)            # Always succeeds.
347     int                 PyObject_HasAttrString          (object, char *)            # Always succeeds.
348     long                PyObject_Hash                   (object)                    except -1
349     int                 PyObject_IsInstance             (object, object)            except -1
350     int                 PyObject_IsSubclass             (object, object)            except -1
351     int                 PyObject_IsTrue                 (object)                    except -1
352     Py_ssize_t          PyObject_Length                 (object)                    except -1
353     int                 PyObject_Not                    (object)                    except -1
354     int                 PyObject_Print                  (object, FILE *, int)       except -1
355     object              PyObject_Repr                   (object)
356     object              PyObject_RichCompare            (object, object, int)
357     int                 PyObject_RichCompareBool        (object, object, int)       except -1
358     int                 PyObject_SetAttr                (object, object, object)    except -1
359     int                 PyObject_SetAttrString          (object, char *, object)    except -1
360     int                 PyObject_SetItem                (object, object, object)    except -1
361     Py_ssize_t          PyObject_Size                   (object)                    except -1
362     object              PyObject_Str                    (object)
363     object              PyObject_Type                   (object)
364     int                 PyObject_TypeCheck              (object, object)            # Always succeeds.
365     object              PyObject_Unicode                (object)
367     ###############################################################################################
368     # pyerrors
369     ###############################################################################################
370     int                 PyErr_BadArgument               ()
371     void                PyErr_BadInternalCall           ()
372     int                 PyErr_CheckSignals              ()
373     void                PyErr_Clear                     ()
374     int                 PyErr_ExceptionMatches          (object)
375     object              PyErr_Format                    (object, char *, ...)
376     int                 PyErr_GivenExceptionMatches     (object, object)
377     object              PyErr_NoMemory                  ()
378     object              PyErr_Occurred                  ()
379     void                PyErr_Restore                   (object, object, object)
380     object              PyErr_SetFromErrno              (object)
381     object              PyErr_SetFromErrnoWithFilename  (object, char *)
382     object              PyErr_SetFromErrnoWithFilenameObject    (object, object)
383     void                PyErr_SetInterrupt              ()
384     void                PyErr_SetNone                   (object)
385     void                PyErr_SetObject                 (object, object)
386     void                PyErr_SetString                 (object, char *)
387     int                 PyErr_Warn                      (object, char *)
388     int                 PyErr_WarnExplicit              (object, char *, char *, int, char *, object)
389     void                PyErr_WriteUnraisable           (object)
391     ###############################################################################################
392     # pyeval
393     # Be extremely careful with these functions.
394     ###############################################################################################
396     ctypedef struct PyThreadState:
397         PyFrameObject * frame
398         int recursion_depth
399         void * curexc_type, * curexc_value, * curexc_traceback
400         void * exc_type, * exc_value, * exc_traceback
402     void                PyEval_AcquireLock              ()
403     void                PyEval_ReleaseLock              ()
404     void                PyEval_AcquireThread            (PyThreadState *)
405     void                PyEval_ReleaseThread            (PyThreadState *)
406     PyThreadState*      PyEval_SaveThread               ()
407     void                PyEval_RestoreThread            (PyThreadState *)
409     ###############################################################################################
410     # pystate
411     # Be extremely careful with these functions.  Read PEP 311 for more detail.
412     ###############################################################################################
414     ctypedef int PyGILState_STATE
415     PyGILState_STATE    PyGILState_Ensure               ()
416     void                PyGILState_Release              (PyGILState_STATE)
418     ctypedef struct PyInterpreterState:
419         pass
421     PyThreadState*      PyThreadState_New               (PyInterpreterState *)
422     void                PyThreadState_Clear             (PyThreadState *)
423     void                PyThreadState_Delete            (PyThreadState *)
424     PyThreadState*      PyThreadState_Get               ()
425     PyThreadState*      PyThreadState_Swap              (PyThreadState *tstate)
426     # XXX: Borrowed reference.
427     #object              PyThreadState_GetDict          ()
429     ###############################################################################################
430     # run
431     # Functions for embedded interpreters are not included.
432     ###############################################################################################
433     ctypedef struct PyCompilerFlags:
434         int cf_flags
436     ctypedef struct _node:
437         pass
439     ctypedef void (*PyOS_sighandler_t)(int)
441     void                PyErr_Display                   (object, object, object)
442     void                PyErr_Print                     ()
443     void                PyErr_PrintEx                   (int)
444     char *              PyOS_Readline                   (FILE *, FILE *, char *)
445     PyOS_sighandler_t   PyOS_getsig                     (int)
446     PyOS_sighandler_t   PyOS_setsig                     (int, PyOS_sighandler_t)
447     _node *             PyParser_SimpleParseFile        (FILE *, char *, int)       except NULL
448     _node *             PyParser_SimpleParseFileFlags   (FILE *, char *, int,
449                                                          int)                       except NULL
450     _node *             PyParser_SimpleParseString      (char *, int)               except NULL
451     _node *             PyParser_SimpleParseStringFlagsFilename(char *, char *,
452                                                          int, int)                  except NULL
453     _node *             PyParser_SimpleParseStringFlags (char *, int, int)          except NULL
454     int                 PyRun_AnyFile                   (FILE *, char *)            except -1
455     int                 PyRun_AnyFileEx                 (FILE *, char *, int)       except -1
456     int                 PyRun_AnyFileExFlags            (FILE *, char *, int,
457                                                          PyCompilerFlags *)         except -1
458     int                 PyRun_AnyFileFlags              (FILE *, char *,
459                                                          PyCompilerFlags *)         except -1
460     object              PyRun_File                      (FILE *, char *, int,
461                                                          object, object)
462     object              PyRun_FileEx                    (FILE *, char *, int,
463                                                          object, object, int)
464     object              PyRun_FileExFlags               (FILE *, char *, int,
465                                                          object, object, int,
466                                                          PyCompilerFlags *)
467     object              PyRun_FileFlags                 (FILE *, char *, int,
468                                                          object, object,
469                                                          PyCompilerFlags *)
470     int                 PyRun_InteractiveLoop           (FILE *, char *)            except -1
471     int                 PyRun_InteractiveLoopFlags      (FILE *, char *,
472                                                          PyCompilerFlags *)         except -1
473     int                 PyRun_InteractiveOne            (FILE *, char *)            except -1
474     int                 PyRun_InteractiveOneFlags       (FILE *, char *,
475                                                          PyCompilerFlags *)         except -1
476     int                 PyRun_SimpleFile                (FILE *, char *)            except -1
477     int                 PyRun_SimpleFileEx              (FILE *, char *, int)       except -1
478     int                 PyRun_SimpleFileExFlags         (FILE *, char *, int,
479                                                          PyCompilerFlags *)         except -1
480     int                 PyRun_SimpleString              (char *)                    except -1
481     int                 PyRun_SimpleStringFlags         (char *, PyCompilerFlags *) except -1
482     object              PyRun_String                    (char *, int, object,
483                                                          object)
484     object              PyRun_StringFlags               (char *, int, object,
485                                                          object, PyCompilerFlags *)
486     int                 Py_AtExit                       (void (*func)())
487     object              Py_CompileString                (char *, char *, int)
488     object              Py_CompileStringFlags           (char *, char *, int, PyCompilerFlags *)
489     void                Py_Exit                         (int)
490     int                 Py_FdIsInteractive              (FILE *, char *)            # Always succeeds.
491     char *              Py_GetBuildInfo                 ()
492     char *              Py_GetCompiler                  ()
493     char *              Py_GetCopyright                 ()
494     char *              Py_GetExecPrefix                ()
495     char *              Py_GetPath                      ()
496     char *              Py_GetPlatform                  ()
497     char *              Py_GetPrefix                    ()
498     char *              Py_GetProgramFullPath           ()
499     char *              Py_GetProgramName               ()
500     char *              Py_GetPythonHome                ()
501     char *              Py_GetVersion                   ()
503     ###############################################################################################
504     # sequence
505     ###############################################################################################
506     int                 PySequence_Check                (object)                    # Always succeeds.
507     object              PySequence_Concat               (object, object)
508     int                 PySequence_Contains             (object, object)            except -1
509     Py_ssize_t          PySequence_Count                (object, object)            except -1
510     int                 PySequence_DelItem              (object, Py_ssize_t)        except -1
511     int                 PySequence_DelSlice             (object, Py_ssize_t, Py_ssize_t) except -1
512     object              PySequence_Fast                 (object, char *)
513     int                 PySequence_Fast_GET_SIZE        (object)
514     object              PySequence_GetItem              (object, Py_ssize_t)
515     object              PySequence_GetSlice             (object, Py_ssize_t, Py_ssize_t)
516     object              PySequence_ITEM                 (object, int)
517     int                 PySequence_In                   (object, object)            except -1
518     object              PySequence_InPlaceConcat        (object, object)
519     object              PySequence_InPlaceRepeat        (object, Py_ssize_t)
520     Py_ssize_t          PySequence_Index                (object, object)            except -1
521     Py_ssize_t          PySequence_Length               (object)                    except -1
522     object              PySequence_List                 (object)
523     object              PySequence_Repeat               (object, Py_ssize_t)
524     int                 PySequence_SetItem              (object, Py_ssize_t, object) except -1
525     int                 PySequence_SetSlice             (object, Py_ssize_t, Py_ssize_t, object) except -1
526     Py_ssize_t          PySequence_Size                 (object)                    except -1
527     object              PySequence_Tuple                (object)
529     ###############################################################################################
530     # string
531     ###############################################################################################
532     PyTypeObject PyString_Type
533     # Pyrex cannot support resizing because you have no choice but to use
534     # realloc which may call free() on the object, and there's no way to tell
535     # Pyrex to "forget" reference counting for the object.
536     #int                 _PyString_Resize                (object *, Py_ssize_t)             except -1
537     char *              PyString_AS_STRING              (object)                    # Always succeeds.
538     object              PyString_AsDecodedObject        (object, char *, char *)
539     object              PyString_AsEncodedObject        (object, char *, char *)
540     object              PyString_AsEncodedString        (object, char *, char *)
541     char *              PyString_AsString               (object)                    except NULL
542     int                 PyString_AsStringAndSize        (object, char **, Py_ssize_t *)    except -1
543     int                 PyString_Check                  (object)                    # Always succeeds.
544     int                 PyString_CHECK_INTERNED         (object)                    # Always succeeds.
545     int                 PyString_CheckExact             (object)                    # Always succeeds.
546     # XXX: Pyrex doesn't support pointer to a python object?
547     #void                PyString_Concat                 (object *, object)
548     # XXX: Pyrex doesn't support pointer to a python object?
549     #void                PyString_ConcatAndDel           (object *, object)
550     object              PyString_Decode                 (char *, int, char *, char *)
551     object              PyString_DecodeEscape           (char *, int, char *, int, char *)
552     object              PyString_Encode                 (char *, int, char *, char *)
553     object              PyString_Format                 (object, object)
554     object              PyString_FromFormat             (char*, ...)
555     object              PyString_FromFormatV            (char*, va_list)
556     object              PyString_FromString             (char *)
557     object              PyString_FromStringAndSize      (char *, Py_ssize_t)
558     Py_ssize_t          PyString_GET_SIZE               (object)                    # Always succeeds.
559     object              PyString_InternFromString       (char *)
560     # XXX: Pyrex doesn't support pointer to a python object?
561     #void                PyString_InternImmortal         (object*)
562     # XXX: Pyrex doesn't support pointer to a python object?
563     #void                PyString_InternInPlace          (object*)
564     object              PyString_Repr                   (object, int)
565     Py_ssize_t          PyString_Size                   (object)                    except -1
567     # Disgusting hack to access internal object values.
568     ctypedef struct PyStringObject:
569         int ob_refcnt
570         PyTypeObject * ob_type
571         int ob_size
572         long ob_shash
573         int ob_sstate
574         char * ob_sval
576     ###############################################################################################
577     # tuple
578     ###############################################################################################
579     PyTypeObject PyTuple_Type
580     # See PyString_Resize note about resizing.
581     #int                 _PyTuple_Resize                 (object*, Py_ssize_t)              except -1
582     int                 PyTuple_Check                   (object)                    # Always succeeds.
583     int                 PyTuple_CheckExact              (object)                    # Always succeeds.
584     Py_ssize_t          PyTuple_GET_SIZE                (object)                    # Always succeeds.
585     object              PyTuple_GetSlice                (object, Py_ssize_t, Py_ssize_t)
586     object              PyTuple_New                     (Py_ssize_t)
587     object              PyTuple_Pack                    (Py_ssize_t, ...)
588     Py_ssize_t          PyTuple_Size                    (object)                    except -1
590     ###############################################################################################
591     # Dangerous things!
592     # Do not use these unless you really, really know what you are doing.
593     ###############################################################################################
594     void                Py_INCREF                       (object)
595     void                Py_XINCREF                      (object)
596     void                Py_DECREF                       (object)
597     void                Py_XDECREF                      (object)
598     void                Py_CLEAR                        (object)
600     # XXX: Stolen reference.
601     void                PyTuple_SET_ITEM                (object, Py_ssize_t, value)
602     # XXX: Borrowed reference.
603     object              PyTuple_GET_ITEM                (object, Py_ssize_t)
604     # XXX: Borrowed reference.
605     object              PyTuple_GetItem                 (object, Py_ssize_t)
606     # XXX: Stolen reference.
607     int                 PyTuple_SetItem                 (object, Py_ssize_t, object)       except -1
609     # XXX: Steals reference.
610     int                 PyList_SetItem                  (object, Py_ssize_t, object)       except -1
611     # XXX: Borrowed reference
612     object              PyList_GetItem                  (object, Py_ssize_t)
613     # XXX: Borrowed reference, no NULL on error.
614     object              PyList_GET_ITEM                 (object, Py_ssize_t)
615     # XXX: Stolen reference.
616     void                PyList_SET_ITEM                 (object, Py_ssize_t, object)
618     # XXX: Borrowed reference.
619     object              PySequence_Fast_GET_ITEM        (object, Py_ssize_t)
621     # First parameter _must_ be a PyStringObject.
622     object              _PyString_Join                  (object, object)