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