This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pytab.py
3209 lines (3207 loc) · 253 KB
/
pytab.py
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
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# coding: utf-8
"""
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
In case you're wondering, I generated this by parsing the Python headers, and then scraping the Python API documentation
site for descriptions of each function.
"""
from _kernel32 import *
from pyctypes import *
def populate_exports(dll):
try:
dll._PyObject_GC_Malloc.restype = POINTER(PyObject)
dll._PyObject_GC_Malloc.argtypes = [ c_size_t ]
dll._PyObject_GC_New.restype = POINTER(PyObject)
dll._PyObject_GC_New.argtypes = [ POINTER(py_object) ]
dll._PyObject_GC_NewVar.restype = POINTER(PyVarObject)
dll._PyObject_GC_NewVar.argtypes = [ POINTER(py_object), c_ssize_t ]
dll.PyObject_GC_Track.restype = None
dll.PyObject_GC_Track.argtypes = [ c_void_p ]
dll.PyObject_GC_Track.__doc__ = """Adds the object op to the set of container objects tracked by the
collector. The collector can run at unexpected times so objects must be
valid while being tracked. This should be called once all the fields
followed by the tp_traverse handler become valid, usually near the
end of the constructor."""
dll.PyObject_GC_UnTrack.restype = None
dll.PyObject_GC_UnTrack.argtypes = [ c_void_p ]
dll.PyObject_GC_UnTrack.__doc__ = """Remove the object op from the set of container objects tracked by the
collector. Note that PyObject_GC_Track() can be called again on
this object to add it back to the set of tracked objects. The deallocator
( tp_dealloc handler) should call this for the object before any of
the fields used by the tp_traverse handler become invalid."""
dll.PyObject_GC_Del.restype = None
dll.PyObject_GC_Del.argtypes = [ c_void_p ]
dll.PyObject_GC_Del.__doc__ = """Releases memory allocated to an object using PyObject_GC_New() or PyObject_GC_NewVar() ."""
dll.Py_FatalError.restype = None
dll.Py_FatalError.argtypes = [ c_char_p ]
dll.Py_FatalError.__doc__ = """Print a fatal error message and kill the process. No cleanup is performed.
This function should only be invoked when a condition is detected that would
make it dangerous to continue using the Python interpreter; e.g., when the
object administration appears to be corrupted. On Unix, the standard C library
function abort() is called which will attempt to produce a core file."""
dll.PyUnicodeUCS2_FromUnicode.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromUnicode.argtypes = [ c_wchar_p, c_ssize_t ]
dll.PyUnicodeUCS2_FromStringAndSize.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromStringAndSize.argtypes = [ c_char_p, c_ssize_t ]
dll.PyUnicodeUCS2_FromString.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromString.argtypes = [ c_char_p ]
dll.PyUnicodeUCS2_AsUnicode.restype = c_wchar_p
dll.PyUnicodeUCS2_AsUnicode.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_GetSize.restype = c_ssize_t
dll.PyUnicodeUCS2_GetSize.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_GetMax.restype = c_wchar
dll.PyUnicodeUCS2_GetMax.argtypes = [ ]
dll.PyUnicodeUCS2_Resize.restype = c_int
dll.PyUnicodeUCS2_Resize.argtypes = [ POINTER(POINTER(PyObject)), c_ssize_t ]
dll.PyUnicodeUCS2_FromEncodedObject.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromEncodedObject.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyUnicodeUCS2_FromObject.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromObject.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_FromFormatV.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromFormatV.argtypes = [ c_char_p, va_list ]
dll.PyUnicodeUCS2_FromFormat.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromFormat.argtypes = [ c_char_p, va_list ]
dll._PyUnicode_FormatAdvanced.restype = POINTER(PyObject)
dll._PyUnicode_FormatAdvanced.argtypes = [ POINTER(PyObject), c_wchar_p, c_ssize_t ]
dll.PyUnicodeUCS2_FromWideChar.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromWideChar.argtypes = [ c_wchar_p, c_ssize_t ]
dll.PyUnicodeUCS2_AsWideChar.restype = c_ssize_t
dll.PyUnicodeUCS2_AsWideChar.argtypes = [ POINTER(py_object), c_wchar_p, c_ssize_t ]
dll.PyUnicodeUCS2_FromOrdinal.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_FromOrdinal.argtypes = [ c_int ]
dll.PyUnicodeUCS2_ClearFreelist.restype = c_int
dll.PyUnicodeUCS2_ClearFreelist.argtypes = [ ]
dll._PyUnicodeUCS2_AsDefaultEncodedString.restype = POINTER(PyObject)
dll._PyUnicodeUCS2_AsDefaultEncodedString.argtypes = [ POINTER(PyObject), c_char_p ]
dll.PyUnicodeUCS2_GetDefaultEncoding.restype = c_char_p
dll.PyUnicodeUCS2_GetDefaultEncoding.argtypes = [ ]
dll.PyUnicodeUCS2_SetDefaultEncoding.restype = c_int
dll.PyUnicodeUCS2_SetDefaultEncoding.argtypes = [ c_char_p ]
dll.PyUnicodeUCS2_Decode.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Decode.argtypes = [ c_char_p, c_ssize_t, c_char_p, c_char_p ]
dll.PyUnicodeUCS2_Encode.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Encode.argtypes = [ c_wchar_p, c_ssize_t, c_char_p, c_char_p ]
dll.PyUnicodeUCS2_AsEncodedObject.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsEncodedObject.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyUnicodeUCS2_AsEncodedString.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsEncodedString.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyUnicode_BuildEncodingMap.restype = POINTER(PyObject)
dll.PyUnicode_BuildEncodingMap.argtypes = [ POINTER(py_object) ]
dll.PyUnicode_DecodeUTF7.restype = POINTER(PyObject)
dll.PyUnicode_DecodeUTF7.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicode_DecodeUTF7.__doc__ = """Create a Unicode object by decoding size bytes of the UTF-7 encoded string s . Return NULL if an exception was raised by the codec."""
dll.PyUnicode_DecodeUTF7Stateful.restype = POINTER(PyObject)
dll.PyUnicode_DecodeUTF7Stateful.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_ssize_t) ]
dll.PyUnicode_DecodeUTF7Stateful.__doc__ = """If consumed is NULL , behave like PyUnicode_DecodeUTF7() . If consumed is not NULL , trailing incomplete UTF-7 base-64 sections will not
be treated as an error. Those bytes will not be decoded and the number of
bytes that have been decoded will be stored in consumed ."""
dll.PyUnicode_EncodeUTF7.restype = POINTER(PyObject)
dll.PyUnicode_EncodeUTF7.argtypes = [ c_wchar_p, c_ssize_t, c_int, c_int, c_char_p ]
dll.PyUnicode_EncodeUTF7.__doc__ = """Encode the Py_UNICODE buffer of the given size using UTF-7 and
return a Python bytes object. Return NULL if an exception was raised by
the codec. If base64SetO is nonzero, "Set O" (punctuation that has no otherwise
special meaning) will be encoded in base-64. If base64WhiteSpace is
nonzero, whitespace will be encoded in base-64. Both are set to zero for the
Python "utf-7" codec."""
dll.PyUnicodeUCS2_DecodeUTF8.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUTF8.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_DecodeUTF8Stateful.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUTF8Stateful.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_ssize_t) ]
dll.PyUnicodeUCS2_AsUTF8String.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsUTF8String.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeUTF8.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeUTF8.argtypes = [ c_wchar_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_DecodeUTF32.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUTF32.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_int) ]
dll.PyUnicodeUCS2_DecodeUTF32Stateful.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUTF32Stateful.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_int), POINTER(c_ssize_t) ]
dll.PyUnicodeUCS2_AsUTF32String.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsUTF32String.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeUTF32.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeUTF32.argtypes = [ c_wchar_p, c_ssize_t, c_char_p, c_int ]
dll.PyUnicodeUCS2_DecodeUTF16.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUTF16.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_int) ]
dll.PyUnicodeUCS2_DecodeUTF16Stateful.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUTF16Stateful.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_int), POINTER(c_ssize_t) ]
dll.PyUnicodeUCS2_AsUTF16String.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsUTF16String.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeUTF16.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeUTF16.argtypes = [ c_wchar_p, c_ssize_t, c_char_p, c_int ]
dll.PyUnicodeUCS2_DecodeUnicodeEscape.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeUnicodeEscape.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_AsUnicodeEscapeString.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsUnicodeEscapeString.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeUnicodeEscape.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeUnicodeEscape.argtypes = [ c_wchar_p, c_ssize_t ]
dll.PyUnicodeUCS2_DecodeRawUnicodeEscape.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeRawUnicodeEscape.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_AsRawUnicodeEscapeString.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsRawUnicodeEscapeString.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeRawUnicodeEscape.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeRawUnicodeEscape.argtypes = [ c_wchar_p, c_ssize_t ]
dll._PyUnicode_DecodeUnicodeInternal.restype = POINTER(PyObject)
dll._PyUnicode_DecodeUnicodeInternal.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_DecodeLatin1.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeLatin1.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_AsLatin1String.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsLatin1String.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeLatin1.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeLatin1.argtypes = [ c_wchar_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_DecodeASCII.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeASCII.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_AsASCIIString.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsASCIIString.argtypes = [ POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeASCII.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeASCII.argtypes = [ c_wchar_p, c_ssize_t, c_char_p ]
dll.PyUnicodeUCS2_DecodeCharmap.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_DecodeCharmap.argtypes = [ c_char_p, c_ssize_t, POINTER(PyObject), c_char_p ]
dll.PyUnicodeUCS2_AsCharmapString.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_AsCharmapString.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_EncodeCharmap.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_EncodeCharmap.argtypes = [ c_wchar_p, c_ssize_t, POINTER(PyObject), c_char_p ]
dll.PyUnicodeUCS2_TranslateCharmap.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_TranslateCharmap.argtypes = [ c_wchar_p, c_ssize_t, POINTER(PyObject), c_char_p ]
dll.PyUnicode_DecodeMBCS.restype = POINTER(PyObject)
dll.PyUnicode_DecodeMBCS.argtypes = [ c_char_p, c_ssize_t, c_char_p ]
dll.PyUnicode_DecodeMBCS.__doc__ = """Return value: New reference. Create a Unicode object by decoding size bytes of the MBCS encoded string s .
Return NULL if an exception was raised by the codec. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyUnicode_DecodeMBCSStateful.restype = POINTER(PyObject)
dll.PyUnicode_DecodeMBCSStateful.argtypes = [ c_char_p, c_ssize_t, c_char_p, POINTER(c_ssize_t) ]
dll.PyUnicode_DecodeMBCSStateful.__doc__ = """If consumed is NULL , behave like PyUnicode_DecodeMBCS() . If consumed is not NULL , PyUnicode_DecodeMBCSStateful() will not decode
trailing lead byte and the number of bytes that have been decoded will be stored
in consumed . New in version 2.5."""
dll.PyUnicode_AsMBCSString.restype = POINTER(PyObject)
dll.PyUnicode_AsMBCSString.argtypes = [ POINTER(PyObject) ]
dll.PyUnicode_AsMBCSString.__doc__ = """Return value: New reference. Encode a Unicode object using MBCS and return the result as Python string
object. Error handling is "strict". Return NULL if an exception was raised
by the codec."""
dll.PyUnicode_EncodeMBCS.restype = POINTER(PyObject)
dll.PyUnicode_EncodeMBCS.argtypes = [ c_wchar_p, c_ssize_t, c_char_p ]
dll.PyUnicode_EncodeMBCS.__doc__ = """Return value: New reference. Encode the Py_UNICODE buffer of the given size using MBCS and return a
Python string object. Return NULL if an exception was raised by the codec. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyUnicodeUCS2_EncodeDecimal.restype = c_int
dll.PyUnicodeUCS2_EncodeDecimal.argtypes = [ c_wchar_p, c_ssize_t, c_char_p, c_char_p ]
dll.PyUnicodeUCS2_Concat.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Concat.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_Split.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Split.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_ssize_t ]
dll.PyUnicodeUCS2_Splitlines.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Splitlines.argtypes = [ POINTER(PyObject), c_int ]
dll.PyUnicodeUCS2_Partition.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Partition.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_RPartition.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_RPartition.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_RSplit.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_RSplit.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_ssize_t ]
dll.PyUnicodeUCS2_Translate.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Translate.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_char_p ]
dll.PyUnicodeUCS2_Join.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Join.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_Tailmatch.restype = c_ssize_t
dll.PyUnicodeUCS2_Tailmatch.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_ssize_t, c_ssize_t, c_int ]
dll.PyUnicodeUCS2_Find.restype = c_ssize_t
dll.PyUnicodeUCS2_Find.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_ssize_t, c_ssize_t, c_int ]
dll.PyUnicodeUCS2_Count.restype = c_ssize_t
dll.PyUnicodeUCS2_Count.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_ssize_t, c_ssize_t ]
dll.PyUnicodeUCS2_Replace.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Replace.argtypes = [ POINTER(PyObject), POINTER(PyObject), POINTER(PyObject), c_ssize_t ]
dll.PyUnicodeUCS2_Compare.restype = c_int
dll.PyUnicodeUCS2_Compare.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_RichCompare.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_RichCompare.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_int ]
dll.PyUnicodeUCS2_Format.restype = POINTER(PyObject)
dll.PyUnicodeUCS2_Format.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyUnicodeUCS2_Contains.restype = c_int
dll.PyUnicodeUCS2_Contains.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll._PyUnicode_XStrip.restype = POINTER(PyObject)
dll._PyUnicode_XStrip.argtypes = [ POINTER(py_object), c_int, POINTER(PyObject) ]
dll._PyUnicodeUCS2_IsLowercase.restype = c_int
dll._PyUnicodeUCS2_IsLowercase.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsUppercase.restype = c_int
dll._PyUnicodeUCS2_IsUppercase.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsTitlecase.restype = c_int
dll._PyUnicodeUCS2_IsTitlecase.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsWhitespace.restype = c_int
dll._PyUnicodeUCS2_IsWhitespace.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsLinebreak.restype = c_int
dll._PyUnicodeUCS2_IsLinebreak.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_ToLowercase.restype = c_wchar
dll._PyUnicodeUCS2_ToLowercase.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_ToUppercase.restype = c_wchar
dll._PyUnicodeUCS2_ToUppercase.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_ToTitlecase.restype = c_wchar
dll._PyUnicodeUCS2_ToTitlecase.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_ToDecimalDigit.restype = c_int
dll._PyUnicodeUCS2_ToDecimalDigit.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_ToDigit.restype = c_int
dll._PyUnicodeUCS2_ToDigit.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_ToNumeric.restype = c_double
dll._PyUnicodeUCS2_ToNumeric.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsDecimalDigit.restype = c_int
dll._PyUnicodeUCS2_IsDecimalDigit.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsDigit.restype = c_int
dll._PyUnicodeUCS2_IsDigit.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsNumeric.restype = c_int
dll._PyUnicodeUCS2_IsNumeric.argtypes = [ c_wchar ]
dll._PyUnicodeUCS2_IsAlpha.restype = c_int
dll._PyUnicodeUCS2_IsAlpha.argtypes = [ c_wchar ]
dll.PyInt_FromString.restype = POINTER(PyObject)
dll.PyInt_FromString.argtypes = [ c_char_p, POINTER(c_char_p), c_int ]
dll.PyInt_FromString.__doc__ = """Return value: New reference. Return a new PyIntObject or PyLongObject based on the string
value in str , which is interpreted according to the radix in base . If pend is non- NULL , *pend will point to the first character in str which
follows the representation of the number. If base is 0 , the radix will be
determined based on the leading characters of str : if str starts with '0x' or '0X' , radix 16 will be used; if str starts with '0' , radix
8 will be used; otherwise radix 10 will be used. If base is not 0 , it
must be between 2 and 36 , inclusive. Leading spaces are ignored. If
there are no digits, ValueError will be raised. If the string represents
a number too large to be contained within the machine's long c_int type
and overflow warnings are being suppressed, a PyLongObject will be
returned. If overflow warnings are not being suppressed, NULL will be
returned in this case."""
dll.PyInt_FromUnicode.restype = POINTER(PyObject)
dll.PyInt_FromUnicode.argtypes = [ c_wchar_p, c_ssize_t, c_int ]
dll.PyInt_FromLong.restype = POINTER(PyObject)
dll.PyInt_FromLong.argtypes = [ c_long ]
dll.PyInt_FromLong.__doc__ = """Return value: New reference. Create a new integer object with a value of ival . The current implementation keeps an array of integer objects for all integers
between -5 and 256 , when you create an c_int in that range you actually
just get back a reference to the existing object. So it should be possible to
change the value of 1 . I suspect the behaviour of Python in this case is
undefined. :-)"""
dll.PyInt_FromSize_t.restype = POINTER(PyObject)
dll.PyInt_FromSize_t.argtypes = [ c_size_t ]
dll.PyInt_FromSize_t.__doc__ = """Create a new integer object with a value of ival . If the value exceeds LONG_MAX , a long integer object is returned. New in version 2.5."""
dll.PyInt_FromSsize_t.restype = POINTER(PyObject)
dll.PyInt_FromSsize_t.argtypes = [ c_ssize_t ]
dll.PyInt_FromSsize_t.__doc__ = """Return value: New reference. Create a new integer object with a value of ival . If the value is larger
than LONG_MAX or smaller than LONG_MIN , a long integer object is
returned. New in version 2.5."""
dll.PyInt_AsLong.restype = c_long
dll.PyInt_AsLong.argtypes = [ POINTER(PyObject) ]
dll.PyInt_AsLong.__doc__ = """Will first attempt to cast the object to a PyIntObject , if it is not
already one, and then return its value. If there is an error, -1 is
returned, and the caller should check PyErr_Occurred() to find out whether
there was an error, or whether the value just happened to be -1."""
dll.PyInt_AsSsize_t.restype = c_ssize_t
dll.PyInt_AsSsize_t.argtypes = [ POINTER(PyObject) ]
dll.PyInt_AsSsize_t.__doc__ = """Will first attempt to cast the object to a PyIntObject or PyLongObject , if it is not already one, and then return its value as Py_ssize_t . New in version 2.5."""
dll.PyInt_AsUnsignedLongMask.restype = c_ulong
dll.PyInt_AsUnsignedLongMask.argtypes = [ POINTER(PyObject) ]
dll.PyInt_AsUnsignedLongMask.__doc__ = """Will first attempt to cast the object to a PyIntObject or PyLongObject , if it is not already one, and then return its value as
unsigned long. This function does not check for overflow. New in version 2.3."""
dll.PyInt_AsUnsignedLongLongMask.restype = c_uint64
dll.PyInt_AsUnsignedLongLongMask.argtypes = [ POINTER(PyObject) ]
dll.PyInt_AsUnsignedLongLongMask.__doc__ = """Will first attempt to cast the object to a PyIntObject or PyLongObject , if it is not already one, and then return its value as
unsigned long long, without checking for overflow. New in version 2.3."""
dll.PyInt_GetMax.restype = c_long
dll.PyInt_GetMax.argtypes = [ ]
dll.PyInt_GetMax.__doc__ = """Return the system's idea of the largest integer it can handle
( LONG_MAX , as defined in the system header files)."""
dll.PyOS_strtoul.restype = c_ulong
dll.PyOS_strtoul.argtypes = [ c_char_p, POINTER(c_char_p), c_int ]
dll.PyOS_strtol.restype = c_long
dll.PyOS_strtol.argtypes = [ c_char_p, POINTER(c_char_p), c_int ]
dll.PyInt_ClearFreeList.restype = c_int
dll.PyInt_ClearFreeList.argtypes = [ ]
dll.PyInt_ClearFreeList.__doc__ = """Clear the integer free list. Return the number of items that could not
be freed. New in version 2.6."""
dll._PyInt_Format.restype = POINTER(PyObject)
dll._PyInt_Format.argtypes = [ POINTER(py_object), c_int, c_int ]
dll._PyInt_FormatAdvanced.restype = POINTER(PyObject)
dll._PyInt_FormatAdvanced.argtypes = [ POINTER(PyObject), c_char_p, c_ssize_t ]
dll.PyBool_FromLong.restype = POINTER(PyObject)
dll.PyBool_FromLong.argtypes = [ c_long ]
dll.PyBool_FromLong.__doc__ = """Return value: New reference. Return a new reference to Py_True or Py_False depending on the
truth value of v . New in version 2.3."""
dll.PyLong_FromLong.restype = POINTER(PyObject)
dll.PyLong_FromLong.argtypes = [ c_long ]
dll.PyLong_FromLong.__doc__ = """Return value: New reference. Return a new PyLongObject object from v , or NULL on failure."""
dll.PyLong_FromUnsignedLong.restype = POINTER(PyObject)
dll.PyLong_FromUnsignedLong.argtypes = [ c_ulong ]
dll.PyLong_FromUnsignedLong.__doc__ = """Return value: New reference. Return a new PyLongObject object from a C unsigned long , or NULL on failure."""
dll.PyLong_FromDouble.restype = POINTER(PyObject)
dll.PyLong_FromDouble.argtypes = [ c_double ]
dll.PyLong_FromDouble.__doc__ = """Return value: New reference. Return a new PyLongObject object from the integer part of v , or NULL on failure."""
dll.PyLong_FromSize_t.restype = POINTER(PyObject)
dll.PyLong_FromSize_t.argtypes = [ c_size_t ]
dll.PyLong_FromSize_t.__doc__ = """Return value: New reference. Return a new PyLongObject object from a C size_t , or NULL on failure. New in version 2.6."""
dll.PyLong_FromSsize_t.restype = POINTER(PyObject)
dll.PyLong_FromSsize_t.argtypes = [ c_ssize_t ]
dll.PyLong_FromSsize_t.__doc__ = """Return value: New reference. Return a new PyLongObject object from a C Py_ssize_t , or NULL on failure. New in version 2.6."""
dll.PyLong_AsLong.restype = c_long
dll.PyLong_AsLong.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsLong.__doc__ = """Return a C long representation of the contents of pylong . If pylong is greater than LONG_MAX , an OverflowError is raised
and -1 will be returned."""
dll.PyLong_AsLongAndOverflow.restype = c_long
dll.PyLong_AsLongAndOverflow.argtypes = [ POINTER(PyObject), POINTER(c_int) ]
dll.PyLong_AsLongAndOverflow.__doc__ = """Return a C long representation of the contents of pylong . If pylong is greater than LONG_MAX or less
than LONG_MIN , set *overflow to 1 or -1 ,
respectively, and return -1 ; otherwise, set *overflow to 0 . If any other exception occurs (for example a TypeError or
MemoryError), then -1 will be returned and *overflow will
be 0 . New in version 2.7."""
dll.PyLong_AsUnsignedLong.restype = c_ulong
dll.PyLong_AsUnsignedLong.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsUnsignedLong.__doc__ = """Return a C unsigned long representation of the contents of pylong .
If pylong is greater than ULONG_MAX , an OverflowError is
raised."""
dll.PyLong_AsUnsignedLongMask.restype = c_ulong
dll.PyLong_AsUnsignedLongMask.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsUnsignedLongMask.__doc__ = """Return a C unsigned long from a Python long integer, without checking
for overflow. New in version 2.3."""
dll.PyLong_AsSsize_t.restype = c_ssize_t
dll.PyLong_AsSsize_t.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsSsize_t.__doc__ = """Return a C Py_ssize_t representation of the contents of pylong . If pylong is greater than PY_SSIZE_T_MAX , an OverflowError is raised
and -1 will be returned. New in version 2.6."""
dll.PyLong_GetInfo.restype = POINTER(PyObject)
dll.PyLong_GetInfo.argtypes = [ ]
dll._PyLong_Frexp.restype = c_double
dll._PyLong_Frexp.argtypes = [ POINTER(py_object), POINTER(c_ssize_t) ]
dll.PyLong_AsDouble.restype = c_double
dll.PyLong_AsDouble.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsDouble.__doc__ = """Return a C double representation of the contents of pylong . If pylong cannot be approximately represented as a double , an OverflowError exception is raised and -1.0 will be returned."""
dll.PyLong_FromVoidPtr.restype = POINTER(PyObject)
dll.PyLong_FromVoidPtr.argtypes = [ c_void_p ]
dll.PyLong_FromVoidPtr.__doc__ = """Return value: New reference. Create a Python integer or long integer from the pointer p . The pointer value
can be retrieved from the resulting value using PyLong_AsVoidPtr() . New in version 1.5.2. Changed in version 2.5: If the integer is larger than LONG_MAX, a positive long integer is returned."""
dll.PyLong_AsVoidPtr.restype = c_void_p
dll.PyLong_AsVoidPtr.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsVoidPtr.__doc__ = """Convert a Python integer or long integer pylong to a C void pointer.
If pylong cannot be converted, an OverflowError will be raised. This
is only assured to produce a usable void pointer for values created
with PyLong_FromVoidPtr() . New in version 1.5.2. Changed in version 2.5: For values outside 0..LONG_MAX, both signed and unsigned integers are accepted."""
dll.PyLong_FromLongLong.restype = POINTER(PyObject)
dll.PyLong_FromLongLong.argtypes = [ c_int64 ]
dll.PyLong_FromLongLong.__doc__ = """Return value: New reference. Return a new PyLongObject object from a C long long , or NULL on failure."""
dll.PyLong_FromUnsignedLongLong.restype = POINTER(PyObject)
dll.PyLong_FromUnsignedLongLong.argtypes = [ c_ulonglong ]
dll.PyLong_FromUnsignedLongLong.__doc__ = """Return value: New reference. Return a new PyLongObject object from a C unsigned long long ,
or NULL on failure."""
dll.PyLong_AsLongLong.restype = c_int64
dll.PyLong_AsLongLong.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsLongLong.__doc__ = """Return a C long long from a Python long integer. If pylong cannot be represented as a long long , an OverflowError is raised and -1 is returned. New in version 2.2."""
dll.PyLong_AsUnsignedLongLong.restype = c_uint64
dll.PyLong_AsUnsignedLongLong.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsUnsignedLongLong.__doc__ = """Return a C unsigned long long from a Python long integer. If pylong cannot be represented as an unsigned long long , an OverflowError is raised and (unsigned long long)-1 is
returned. New in version 2.2. Changed in version 2.7: A negative pylong now raises OverflowError , not TypeError ."""
dll.PyLong_AsUnsignedLongLongMask.restype = c_uint64
dll.PyLong_AsUnsignedLongLongMask.argtypes = [ POINTER(PyObject) ]
dll.PyLong_AsUnsignedLongLongMask.__doc__ = """Return a C unsigned long long from a Python long integer, without
checking for overflow. New in version 2.3."""
dll.PyLong_AsLongLongAndOverflow.restype = c_int64
dll.PyLong_AsLongLongAndOverflow.argtypes = [ POINTER(PyObject), POINTER(c_int) ]
dll.PyLong_AsLongLongAndOverflow.__doc__ = """Return a C long long representation of the contents of pylong . If pylong is greater than PY_LLONG_MAX or less
than PY_LLONG_MIN , set *overflow to 1 or -1 ,
respectively, and return -1 ; otherwise, set *overflow to 0 . If any other exception occurs (for example a TypeError or
MemoryError), then -1 will be returned and *overflow will
be 0 . New in version 2.7."""
dll.PyLong_FromString.restype = POINTER(PyObject)
dll.PyLong_FromString.argtypes = [ c_char_p, POINTER(c_char_p), c_int ]
dll.PyLong_FromString.__doc__ = """Return value: New reference. Return a new PyLongObject based on the string value in str , which is
interpreted according to the radix in base . If pend is non- NULL , *pend will point to the first character in str which follows the
representation of the number. If base is 0 , the radix will be determined
based on the leading characters of str : if str starts with '0x' or '0X' , radix 16 will be used; if str starts with '0' , radix 8 will be
used; otherwise radix 10 will be used. If base is not 0 , it must be
between 2 and 36 , inclusive. Leading spaces are ignored. If there are
no digits, ValueError will be raised."""
dll.PyLong_FromUnicode.restype = POINTER(PyObject)
dll.PyLong_FromUnicode.argtypes = [ c_wchar_p, c_ssize_t, c_int ]
dll.PyLong_FromUnicode.__doc__ = """Return value: New reference. Convert a sequence of Unicode digits to a Python long integer value. The first
parameter, u , points to the first character of the Unicode string, length gives the number of characters, and base is the radix for the conversion. The
radix must be in the range [2, 36]; if it is out of range, ValueError will be raised. New in version 1.6. Changed in version 2.5: This function used an c_int for length . This might require
changes in your code for properly supporting 64-bit systems."""
dll._PyLong_Sign.restype = c_int
dll._PyLong_Sign.argtypes = [ POINTER(PyObject) ]
dll._PyLong_NumBits.restype = c_size_t
dll._PyLong_NumBits.argtypes = [ POINTER(PyObject) ]
dll._PyLong_FromByteArray.restype = POINTER(PyObject)
dll._PyLong_FromByteArray.argtypes = [ c_uchar_p, c_size_t, c_int, c_int ]
dll._PyLong_AsByteArray.restype = c_int
dll._PyLong_AsByteArray.argtypes = [ POINTER(py_object), c_uchar_p, c_size_t, c_int, c_int ]
dll._PyLong_Format.restype = POINTER(PyObject)
dll._PyLong_Format.argtypes = [ POINTER(PyObject), c_int, c_int, c_int ]
dll._PyLong_FormatAdvanced.restype = POINTER(PyObject)
dll._PyLong_FormatAdvanced.argtypes = [ POINTER(PyObject), c_char_p, c_ssize_t ]
dll.PyFloat_GetMax.restype = c_double
dll.PyFloat_GetMax.argtypes = [ ]
dll.PyFloat_GetMax.__doc__ = """Return the maximum representable finite float DBL_MAX as C double . New in version 2.6."""
dll.PyFloat_GetMin.restype = c_double
dll.PyFloat_GetMin.argtypes = [ ]
dll.PyFloat_GetMin.__doc__ = """Return the minimum normalized positive float DBL_MIN as C double . New in version 2.6."""
dll.PyFloat_GetInfo.restype = POINTER(PyObject)
dll.PyFloat_GetInfo.argtypes = [ ]
dll.PyFloat_GetInfo.__doc__ = """Return a structseq instance which contains information about the
precision, minimum and maximum values of a float. It's a thin wrapper
around the header file float.h . New in version 2.6."""
dll.PyFloat_FromString.restype = POINTER(PyObject)
dll.PyFloat_FromString.argtypes = [ POINTER(PyObject), POINTER(c_char_p) ]
dll.PyFloat_FromString.__doc__ = """Return value: New reference. Create a PyFloatObject object based on the string value in str , or NULL on failure. The pend argument is ignored. It remains only for
backward compatibility."""
dll.PyFloat_FromDouble.restype = POINTER(PyObject)
dll.PyFloat_FromDouble.argtypes = [ c_double ]
dll.PyFloat_FromDouble.__doc__ = """Return value: New reference. Create a PyFloatObject object from v , or NULL on failure."""
dll.PyFloat_AsDouble.restype = c_double
dll.PyFloat_AsDouble.argtypes = [ POINTER(PyObject) ]
dll.PyFloat_AsDouble.__doc__ = """Return a C double representation of the contents of pyfloat . If pyfloat is not a Python floating point object but has a __float__() method, this method will first be called to convert pyfloat into a float.
This method returns -1.0 upon failure, so one should call PyErr_Occurred() to check for errors."""
dll.PyFloat_AsReprString.restype = None
dll.PyFloat_AsReprString.argtypes = [ c_char_p, POINTER(py_object) ]
dll.PyFloat_AsReprString.__doc__ = """Same as PyFloat_AsString, except uses the same rules as repr() . The length of buf should be at least 100. This function is unsafe to call because it writes to a buffer whose
length it does not know. Deprecated since version 2.7: Use PyObject_Repr() or PyOS_double_to_string() instead."""
dll.PyFloat_AsString.restype = None
dll.PyFloat_AsString.argtypes = [ c_char_p, POINTER(py_object) ]
dll.PyFloat_AsString.__doc__ = """Convert the argument v to a string, using the same rules as str() . The length of buf should be at least 100. This function is unsafe to call because it writes to a buffer whose
length it does not know. Deprecated since version 2.7: Use PyObject_Str() or PyOS_double_to_string() instead."""
dll._PyFloat_Pack4.restype = c_int
dll._PyFloat_Pack4.argtypes = [ c_double, c_uchar_p, c_int ]
dll._PyFloat_Pack8.restype = c_int
dll._PyFloat_Pack8.argtypes = [ c_double, c_uchar_p, c_int ]
dll._PyFloat_Digits.restype = c_int
dll._PyFloat_Digits.argtypes = [ c_char_p, c_double, POINTER(c_int) ]
dll._PyFloat_DigitsInit.restype = None
dll._PyFloat_DigitsInit.argtypes = [ ]
dll._PyFloat_Unpack4.restype = c_double
dll._PyFloat_Unpack4.argtypes = [ c_uchar_p, c_int ]
dll._PyFloat_Unpack8.restype = c_double
dll._PyFloat_Unpack8.argtypes = [ c_uchar_p, c_int ]
dll.PyFloat_ClearFreeList.restype = c_int
dll.PyFloat_ClearFreeList.argtypes = [ ]
dll.PyFloat_ClearFreeList.__doc__ = """Clear the float free list. Return the number of items that could not
be freed. New in version 2.6."""
dll._PyFloat_FormatAdvanced.restype = POINTER(PyObject)
dll._PyFloat_FormatAdvanced.argtypes = [ POINTER(PyObject), c_char_p, c_ssize_t ]
dll._Py_double_round.restype = POINTER(PyObject)
dll._Py_double_round.argtypes = [ c_double, c_int ]
dll._Py_c_sum.restype = py_object
dll._Py_c_sum.argtypes = [ py_object, py_object ]
dll._Py_c_sum.__doc__ = """Return the sum of two complex numbers, using the C Py_complex representation."""
dll._Py_c_diff.restype = py_object
dll._Py_c_diff.argtypes = [ py_object, py_object ]
dll._Py_c_diff.__doc__ = """Return the difference between two complex numbers, using the C Py_complex representation."""
dll._Py_c_neg.restype = py_object
dll._Py_c_neg.argtypes = [ py_object ]
dll._Py_c_neg.__doc__ = """Return the negation of the complex number complex , using the C Py_complex representation."""
dll._Py_c_prod.restype = py_object
dll._Py_c_prod.argtypes = [ py_object, py_object ]
dll._Py_c_prod.__doc__ = """Return the product of two complex numbers, using the C Py_complex representation."""
dll._Py_c_quot.restype = py_object
dll._Py_c_quot.argtypes = [ py_object, py_object ]
dll._Py_c_quot.__doc__ = """Return the quotient of two complex numbers, using the C Py_complex representation. If divisor is null, this method returns zero and sets errno to EDOM ."""
dll._Py_c_pow.restype = py_object
dll._Py_c_pow.argtypes = [ py_object, py_object ]
dll._Py_c_pow.__doc__ = """Return the exponentiation of num by exp , using the C Py_complex representation. If num is null and exp is not a positive real number,
this method returns zero and sets errno to EDOM ."""
dll._Py_c_abs.restype = c_double
dll._Py_c_abs.argtypes = [ py_object ]
dll.PyComplex_FromCComplex.restype = POINTER(PyObject)
dll.PyComplex_FromCComplex.argtypes = [ py_object ]
dll.PyComplex_FromCComplex.__doc__ = """Return value: New reference. Create a new Python complex number object from a C Py_complex value."""
dll.PyComplex_FromDoubles.restype = POINTER(PyObject)
dll.PyComplex_FromDoubles.argtypes = [ c_double, c_double ]
dll.PyComplex_FromDoubles.__doc__ = """Return value: New reference. Return a new PyComplexObject object from real and imag ."""
dll.PyComplex_RealAsDouble.restype = c_double
dll.PyComplex_RealAsDouble.argtypes = [ POINTER(PyObject) ]
dll.PyComplex_RealAsDouble.__doc__ = """Return the real part of op as a C double ."""
dll.PyComplex_ImagAsDouble.restype = c_double
dll.PyComplex_ImagAsDouble.argtypes = [ POINTER(PyObject) ]
dll.PyComplex_ImagAsDouble.__doc__ = """Return the imaginary part of op as a C double ."""
dll.PyComplex_AsCComplex.restype = py_object
dll.PyComplex_AsCComplex.argtypes = [ POINTER(PyObject) ]
dll.PyComplex_AsCComplex.__doc__ = """Return the Py_complex value of the complex number op .
Upon failure, this method returns -1.0 as a real value. Changed in version 2.6: If op is not a Python complex number object but has a __complex__() method, this method will first be called to convert op to a Python complex
number object."""
dll._PyComplex_FormatAdvanced.restype = POINTER(PyObject)
dll._PyComplex_FormatAdvanced.argtypes = [ POINTER(PyObject), c_char_p, c_ssize_t ]
dll.PyString_FromStringAndSize.restype = POINTER(PyObject)
dll.PyString_FromStringAndSize.argtypes = [ c_char_p, c_ssize_t ]
dll.PyString_FromStringAndSize.__doc__ = """Return value: New reference. Return a new string object with a copy of the string v as value and length len on success, and NULL on failure. If v is NULL , the contents of the
string are uninitialized. Changed in version 2.5: This function used an c_int type for len . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyString_FromString.restype = POINTER(PyObject)
dll.PyString_FromString.argtypes = [ c_char_p ]
dll.PyString_FromString.__doc__ = """Return value: New reference. Return a new string object with a copy of the string v as value on success,
and NULL on failure. The parameter v must not be NULL ; it will not be
checked."""
dll.PyString_FromFormatV.restype = POINTER(PyObject)
dll.PyString_FromFormatV.argtypes = [ c_char_p, va_list ]
dll.PyString_FromFormatV.__doc__ = """Return value: New reference. Identical to PyString_FromFormat() except that it takes exactly two
arguments."""
dll.PyString_FromFormat.restype = POINTER(PyObject)
dll.PyString_FromFormat.argtypes = [ c_char_p, va_list ]
dll.PyString_FromFormat.__doc__ = """Return value: New reference. Take a C printf() -style format string and a variable number of
arguments, calculate the size of the resulting Python string and return a string
with the values formatted into it. The variable arguments must be C types and
must correspond exactly to the format characters in the format string. The
following format characters are allowed: Format Characters Type Comment %% n/a The literal % character. %c c_int A single character,
represented as an C c_int. %d c_int Exactly equivalent to printf("%d") . %u unsigned c_int Exactly equivalent to printf("%u") . %ld long Exactly equivalent to printf("%ld") . %lu unsigned long Exactly equivalent to printf("%lu") . %lld long long Exactly equivalent to printf("%lld") . %llu unsigned
long long Exactly equivalent to printf("%llu") . %zd Py_ssize_t Exactly equivalent to printf("%zd") . %zu size_t Exactly equivalent to printf("%zu") . %i c_int Exactly equivalent to printf("%i") . %x c_int Exactly equivalent to printf("%x") . %s char* A null-terminated C character
array. %p void* The hex representation of a C
pointer. Mostly equivalent to printf("%p") except that
it is guaranteed to start with
the literal 0x regardless
of what the platform's printf yields. An unrecognized format character causes all the rest of the format string to be
copied as-is to the result string, and any extra arguments discarded. Note The "%lld" and "%llu" format specifiers are only available
when HAVE_LONG_LONG is defined. Changed in version 2.7: Support for "%lld" and "%llu" added."""
dll.PyString_Size.restype = c_ssize_t
dll.PyString_Size.argtypes = [ POINTER(PyObject) ]
dll.PyString_Size.__doc__ = """Return the length of the string in string object string . Changed in version 2.5: This function returned an c_int type. This might require changes
in your code for properly supporting 64-bit systems."""
dll.PyString_AsString.restype = c_char_p
dll.PyString_AsString.argtypes = [ POINTER(PyObject) ]
dll.PyString_AsString.__doc__ = """Return a NUL-terminated representation of the contents of string . The pointer
refers to the internal buffer of string , not a copy. The data must not be
modified in any way, unless the string was just created using PyString_FromStringAndSize(NULL, size) . It must not be deallocated. If string is a Unicode object, this function computes the default encoding of string and operates on that. If string is not a string object at all, PyString_AsString() returns NULL and raises TypeError ."""
dll.PyString_Repr.restype = POINTER(PyObject)
dll.PyString_Repr.argtypes = [ POINTER(PyObject), c_int ]
dll.PyString_Concat.restype = None
dll.PyString_Concat.argtypes = [ POINTER(POINTER(PyObject)), POINTER(PyObject) ]
dll.PyString_Concat.__doc__ = """Create a new string object in *string containing the contents of newpart appended to string ; the caller will own the new reference. The reference to
the old value of string will be stolen. If the new string cannot be created,
the old reference to string will still be discarded and the value of *string will be set to NULL ; the appropriate exception will be set."""
dll.PyString_ConcatAndDel.restype = None
dll.PyString_ConcatAndDel.argtypes = [ POINTER(POINTER(PyObject)), POINTER(PyObject) ]
dll.PyString_ConcatAndDel.__doc__ = """Create a new string object in *string containing the contents of newpart appended to string . This version decrements the reference count of newpart ."""
dll._PyString_Resize.restype = c_int
dll._PyString_Resize.argtypes = [ POINTER(POINTER(PyObject)), c_ssize_t ]
dll._PyString_Resize.__doc__ = """A way to resize a string object even though it is "immutable". Only use this to
build up a brand new string object; don't use this if the string may already be
known in other parts of the code. It is an error to call this function if the
refcount on the input string object is not one. Pass the address of an existing
string object as an lvalue (it may be written into), and the new size desired.
On success, *string holds the resized string object and 0 is returned;
the address in *string may differ from its input value. If the reallocation
fails, the original string object at *string is deallocated, *string is
set to NULL , a memory exception is set, and -1 is returned. Changed in version 2.5: This function used an c_int type for newsize . This might
require changes in your code for properly supporting 64-bit systems."""
dll._PyString_Eq.restype = c_int
dll._PyString_Eq.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyString_Format.restype = POINTER(PyObject)
dll.PyString_Format.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyString_Format.__doc__ = """Return value: New reference. Return a new string object from format and args . Analogous to format % args . The args argument must be a tuple."""
dll._PyString_FormatLong.restype = POINTER(PyObject)
dll._PyString_FormatLong.argtypes = [ POINTER(PyObject), c_int, c_int, c_int, POINTER(c_char_p), POINTER(c_int) ]
dll.PyString_DecodeEscape.restype = POINTER(PyObject)
dll.PyString_DecodeEscape.argtypes = [ c_char_p, c_ssize_t, c_char_p, c_ssize_t, c_char_p ]
dll.PyString_InternInPlace.restype = None
dll.PyString_InternInPlace.argtypes = [ POINTER(POINTER(PyObject)) ]
dll.PyString_InternInPlace.__doc__ = """Intern the argument *string in place. The argument must be the address of a
pointer variable pointing to a Python string object. If there is an existing
interned string that is the same as *string , it sets *string to it
(decrementing the reference count of the old string object and incrementing the
reference count of the interned string object), otherwise it leaves *string alone and interns it (incrementing its reference count). (Clarification: even
though there is a lot of talk about reference counts, think of this function as
reference-count-neutral; you own the object after the call if and only if you
owned it before the call.) Note This function is not available in 3.x and does not have a PyBytes alias."""
dll.PyString_InternImmortal.restype = None
dll.PyString_InternImmortal.argtypes = [ POINTER(POINTER(PyObject)) ]
dll.PyString_InternFromString.restype = POINTER(PyObject)
dll.PyString_InternFromString.argtypes = [ c_char_p ]
dll.PyString_InternFromString.__doc__ = """Return value: New reference. A combination of PyString_FromString() and PyString_InternInPlace() , returning either a new string object that has
been interned, or a new ("owned") reference to an earlier interned string object
with the same value. Note This function is not available in 3.x and does not have a PyBytes alias."""
dll._Py_ReleaseInternedStrings.restype = None
dll._Py_ReleaseInternedStrings.argtypes = [ ]
dll._PyString_Join.restype = POINTER(PyObject)
dll._PyString_Join.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyString_Decode.restype = POINTER(PyObject)
dll.PyString_Decode.argtypes = [ c_char_p, c_ssize_t, c_char_p, c_char_p ]
dll.PyString_Decode.__doc__ = """Return value: New reference. Create an object by decoding size bytes of the encoded buffer s using the
codec registered for encoding . encoding and errors have the same meaning
as the parameters of the same name in the unicode() built-in function.
The codec to be used is looked up using the Python codec registry. Return NULL if an exception was raised by the codec. Note This function is not available in 3.x and does not have a PyBytes alias. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyString_Encode.restype = POINTER(PyObject)
dll.PyString_Encode.argtypes = [ c_char_p, c_ssize_t, c_char_p, c_char_p ]
dll.PyString_Encode.__doc__ = """Return value: New reference. Encode the char buffer of the given size by passing it to the codec
registered for encoding and return a Python object. encoding and errors have the same meaning as the parameters of the same name in the string encode() method. The codec to be used is looked up using the Python codec
registry. Return NULL if an exception was raised by the codec. Note This function is not available in 3.x and does not have a PyBytes alias. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyString_AsEncodedObject.restype = POINTER(PyObject)
dll.PyString_AsEncodedObject.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyString_AsEncodedObject.__doc__ = """Return value: New reference. Encode a string object using the codec registered for encoding and return the
result as Python object. encoding and errors have the same meaning as the
parameters of the same name in the string encode() method. The codec to be
used is looked up using the Python codec registry. Return NULL if an exception
was raised by the codec. Note This function is not available in 3.x and does not have a PyBytes alias."""
dll.PyString_AsEncodedString.restype = POINTER(PyObject)
dll.PyString_AsEncodedString.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyString_AsDecodedObject.restype = POINTER(PyObject)
dll.PyString_AsDecodedObject.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyString_AsDecodedObject.__doc__ = """Return value: New reference. Decode a string object by passing it to the codec registered for encoding and
return the result as Python object. encoding and errors have the same
meaning as the parameters of the same name in the string encode() method.
The codec to be used is looked up using the Python codec registry. Return NULL if an exception was raised by the codec. Note This function is not available in 3.x and does not have a PyBytes alias."""
dll.PyString_AsDecodedString.restype = POINTER(PyObject)
dll.PyString_AsDecodedString.argtypes = [ POINTER(PyObject), c_char_p, c_char_p ]
dll.PyString_AsStringAndSize.restype = c_int
dll.PyString_AsStringAndSize.argtypes = [ POINTER(PyObject), POINTER(c_char_p), POINTER(c_ssize_t) ]
dll.PyString_AsStringAndSize.__doc__ = """Return a NUL-terminated representation of the contents of the object obj through the output variables buffer and length . The function accepts both string and Unicode objects as input. For Unicode
objects it returns the default encoded version of the object. If length is NULL , the resulting buffer may not contain NUL characters; if it does, the
function returns -1 and a TypeError is raised. The buffer refers to an internal string buffer of obj , not a copy. The data
must not be modified in any way, unless the string was just created using PyString_FromStringAndSize(NULL, size) . It must not be deallocated. If string is a Unicode object, this function computes the default encoding of string and operates on that. If string is not a string object at all, PyString_AsStringAndSize() returns -1 and raises TypeError . Changed in version 2.5: This function used an c_int * type for length . This might
require changes in your code for properly supporting 64-bit systems."""
dll._PyString_InsertThousandsGroupingLocale.restype = c_ssize_t
dll._PyString_InsertThousandsGroupingLocale.argtypes = [ c_char_p, c_ssize_t, c_char_p, c_ssize_t, c_ssize_t ]
dll._PyString_InsertThousandsGrouping.restype = c_ssize_t
dll._PyString_InsertThousandsGrouping.argtypes = [ c_char_p, c_ssize_t, c_char_p, c_ssize_t, c_ssize_t, c_char_p, c_char_p ]
dll._PyBytes_FormatAdvanced.restype = POINTER(PyObject)
dll._PyBytes_FormatAdvanced.argtypes = [ POINTER(PyObject), c_char_p, c_ssize_t ]
dll.PyMemoryView_GetContiguous.restype = POINTER(PyObject)
dll.PyMemoryView_GetContiguous.argtypes = [ POINTER(PyObject), c_int, c_char ]
dll.PyMemoryView_GetContiguous.__doc__ = """Create a memoryview object to a contiguous chunk of memory (in either
'C' or 'F'ortran order ) from an object that defines the buffer
interface. If memory is contiguous, the memoryview object points to the
original memory. Otherwise copy is made and the memoryview points to a
new bytes object."""
dll.PyMemoryView_FromObject.restype = POINTER(PyObject)
dll.PyMemoryView_FromObject.argtypes = [ POINTER(PyObject) ]
dll.PyMemoryView_FromObject.__doc__ = """Create a memoryview object from an object that defines the new buffer
interface."""
dll.PyMemoryView_FromBuffer.restype = POINTER(PyObject)
dll.PyMemoryView_FromBuffer.argtypes = [ POINTER(py_object) ]
dll.PyMemoryView_FromBuffer.__doc__ = """Create a memoryview object wrapping the given buffer-info structure view .
The memoryview object then owns the buffer, which means you shouldn't
try to release it yourself: it will be released on deallocation of the
memoryview object."""
dll.PyBuffer_FromObject.restype = POINTER(PyObject)
dll.PyBuffer_FromObject.argtypes = [ POINTER(PyObject), c_ssize_t, c_ssize_t ]
dll.PyBuffer_FromObject.__doc__ = """Return value: New reference. Return a new read-only buffer object. This raises TypeError if base doesn't support the read-only buffer protocol or doesn't provide
exactly one buffer segment, or it raises ValueError if offset is
less than zero. The buffer will hold a reference to the base object, and
the buffer's contents will refer to the base object's buffer interface,
starting as position offset and extending for size bytes. If size is Py_END_OF_BUFFER , then the new buffer's contents extend to the
length of the base object's exported buffer data. Changed in version 2.5: This function used an c_int type for offset and size . This
might require changes in your code for properly supporting 64-bit
systems."""
dll.PyBuffer_FromReadWriteObject.restype = POINTER(PyObject)
dll.PyBuffer_FromReadWriteObject.argtypes = [ POINTER(PyObject), c_ssize_t, c_ssize_t ]
dll.PyBuffer_FromReadWriteObject.__doc__ = """Return value: New reference. Return a new writable buffer object. Parameters and exceptions are similar
to those for PyBuffer_FromObject() . If the base object does not
export the writeable buffer protocol, then TypeError is raised. Changed in version 2.5: This function used an c_int type for offset and size . This
might require changes in your code for properly supporting 64-bit
systems."""
dll.PyBuffer_FromMemory.restype = POINTER(PyObject)
dll.PyBuffer_FromMemory.argtypes = [ c_void_p, c_ssize_t ]
dll.PyBuffer_FromMemory.__doc__ = """Return value: New reference. Return a new read-only buffer object that reads from a specified location
in memory, with a specified size. The caller is responsible for ensuring
that the memory buffer, passed in as ptr , is not deallocated while the
returned buffer object exists. Raises ValueError if size is less
than zero. Note that Py_END_OF_BUFFER may not be passed for the size parameter; ValueError will be raised in that case. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyBuffer_FromReadWriteMemory.restype = POINTER(PyObject)
dll.PyBuffer_FromReadWriteMemory.argtypes = [ c_void_p, c_ssize_t ]
dll.PyBuffer_FromReadWriteMemory.__doc__ = """Return value: New reference. Similar to PyBuffer_FromMemory() , but the returned buffer is
writable. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyBuffer_New.restype = POINTER(PyObject)
dll.PyBuffer_New.argtypes = [ c_ssize_t ]
dll.PyBuffer_New.__doc__ = """Return value: New reference. Return a new writable buffer object that maintains its own memory buffer of size bytes. ValueError is returned if size is not zero or
positive. Note that the memory buffer (as returned by PyObject_AsWriteBuffer() ) is not specifically aligned. Changed in version 2.5: This function used an c_int type for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyByteArray_FromObject.restype = POINTER(PyObject)
dll.PyByteArray_FromObject.argtypes = [ POINTER(PyObject) ]
dll.PyByteArray_FromObject.__doc__ = """Return a new bytearray object from any object, o , that implements the
buffer protocol."""
dll.PyByteArray_Concat.restype = POINTER(PyObject)
dll.PyByteArray_Concat.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyByteArray_Concat.__doc__ = """Concat bytearrays a and b and return a new bytearray with the result."""
dll.PyByteArray_FromStringAndSize.restype = POINTER(PyObject)
dll.PyByteArray_FromStringAndSize.argtypes = [ c_char_p, c_ssize_t ]
dll.PyByteArray_FromStringAndSize.__doc__ = """Create a new bytearray object from string and its length, len . On
failure, NULL is returned."""
dll.PyByteArray_Size.restype = c_ssize_t
dll.PyByteArray_Size.argtypes = [ POINTER(PyObject) ]
dll.PyByteArray_Size.__doc__ = """Return the size of bytearray after checking for a NULL pointer."""
dll.PyByteArray_AsString.restype = c_char_p
dll.PyByteArray_AsString.argtypes = [ POINTER(PyObject) ]
dll.PyByteArray_AsString.__doc__ = """Return the contents of bytearray as a char array after checking for a NULL pointer."""
dll.PyByteArray_Resize.restype = c_int
dll.PyByteArray_Resize.argtypes = [ POINTER(PyObject), c_ssize_t ]
dll.PyByteArray_Resize.__doc__ = """Resize the internal buffer of bytearray to len ."""
dll.PyTuple_New.restype = POINTER(PyObject)
dll.PyTuple_New.argtypes = [ c_ssize_t ]
dll.PyTuple_New.__doc__ = """Return value: New reference. Return a new tuple object of size len , or NULL on failure. Changed in version 2.5: This function used an c_int type for len . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyTuple_Size.restype = c_ssize_t
dll.PyTuple_Size.argtypes = [ POINTER(PyObject) ]
dll.PyTuple_Size.__doc__ = """Take a pointer to a tuple object, and return the size of that tuple. Changed in version 2.5: This function returned an c_int type. This might require changes
in your code for properly supporting 64-bit systems."""
dll.PyTuple_GetItem.restype = POINTER(PyObject)
dll.PyTuple_GetItem.argtypes = [ POINTER(PyObject), c_ssize_t ]
dll.PyTuple_GetItem.__doc__ = """Return value: Borrowed reference. Return the object at position pos in the tuple pointed to by p . If pos is
out of bounds, return NULL and sets an IndexError exception. Changed in version 2.5: This function used an c_int type for pos . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyTuple_SetItem.restype = c_int
dll.PyTuple_SetItem.argtypes = [ POINTER(PyObject), c_ssize_t, POINTER(PyObject) ]
dll.PyTuple_SetItem.__doc__ = """Insert a reference to object o at position pos of the tuple pointed to by p . Return 0 on success. Note This function "steals" a reference to o . Changed in version 2.5: This function used an c_int type for pos . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyTuple_GetSlice.restype = POINTER(PyObject)
dll.PyTuple_GetSlice.argtypes = [ POINTER(PyObject), c_ssize_t, c_ssize_t ]
dll.PyTuple_GetSlice.__doc__ = """Return value: New reference. Take a slice of the tuple pointed to by p from low to high and return it
as a new tuple. Changed in version 2.5: This function used an c_int type for low and high . This might
require changes in your code for properly supporting 64-bit systems."""
dll._PyTuple_Resize.restype = c_int
dll._PyTuple_Resize.argtypes = [ POINTER(POINTER(PyObject)), c_ssize_t ]
dll._PyTuple_Resize.__doc__ = """Can be used to resize a tuple. newsize will be the new length of the tuple.
Because tuples are supposed to be immutable, this should only be used if there
is only one reference to the object. Do not use this if the tuple may already
be known to some other part of the code. The tuple will always grow or shrink
at the end. Think of this as destroying the old tuple and creating a new one,
only more efficiently. Returns 0 on success. Client code should never
assume that the resulting value of *p will be the same as before calling
this function. If the object referenced by *p is replaced, the original *p is destroyed. On failure, returns -1 and sets *p to NULL , and
raises MemoryError or SystemError . Changed in version 2.2: Removed unused third parameter, last_is_sticky . Changed in version 2.5: This function used an c_int type for newsize . This might
require changes in your code for properly supporting 64-bit systems."""
dll.PyTuple_Pack.restype = POINTER(PyObject)
dll.PyTuple_Pack.argtypes = [ c_ssize_t, va_list ]
dll.PyTuple_Pack.__doc__ = """Return value: New reference. Return a new tuple object of size n , or NULL on failure. The tuple values
are initialized to the subsequent n C arguments pointing to Python objects. PyTuple_Pack(2, a, b) is equivalent to Py_BuildValue("(OO)", a, b) . New in version 2.4. Changed in version 2.5: This function used an c_int type for n . This might require
changes in your code for properly supporting 64-bit systems."""
dll._PyTuple_MaybeUntrack.restype = None
dll._PyTuple_MaybeUntrack.argtypes = [ POINTER(PyObject) ]
dll.PyTuple_ClearFreeList.restype = c_int
dll.PyTuple_ClearFreeList.argtypes = [ ]
dll.PyTuple_ClearFreeList.__doc__ = """Clear the free list. Return the total number of freed items. New in version 2.6."""
dll.PyList_New.restype = POINTER(PyObject)
dll.PyList_New.argtypes = [ c_ssize_t ]
dll.PyList_New.__doc__ = """Return value: New reference. Return a new list of length len on success, or NULL on failure. Note If len is greater than zero, the returned list object's items are
set to NULL . Thus you cannot use abstract API functions such as PySequence_SetItem() or expose the object to Python code before
setting all items to a real object with PyList_SetItem() . Changed in version 2.5: This function used an c_int for size . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyList_Size.restype = c_ssize_t
dll.PyList_Size.argtypes = [ POINTER(PyObject) ]
dll.PyList_Size.__doc__ = """Return the length of the list object in list ; this is equivalent to len(list) on a list object. Changed in version 2.5: This function returned an c_int . This might require changes in
your code for properly supporting 64-bit systems."""
dll.PyList_GetItem.restype = POINTER(PyObject)
dll.PyList_GetItem.argtypes = [ POINTER(PyObject), c_ssize_t ]
dll.PyList_GetItem.__doc__ = """Return value: Borrowed reference. Return the object at position index in the list pointed to by list . The
position must be positive, indexing from the end of the list is not
supported. If index is out of bounds, return NULL and set an IndexError exception. Changed in version 2.5: This function used an c_int for index . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyList_SetItem.restype = c_int
dll.PyList_SetItem.argtypes = [ POINTER(PyObject), c_ssize_t, POINTER(PyObject) ]
dll.PyList_SetItem.__doc__ = """Set the item at index index in list to item . Return 0 on success
or -1 on failure. Note This function "steals" a reference to item and discards a reference to
an item already in the list at the affected position. Changed in version 2.5: This function used an c_int for index . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyList_Insert.restype = c_int
dll.PyList_Insert.argtypes = [ POINTER(PyObject), c_ssize_t, POINTER(PyObject) ]
dll.PyList_Insert.__doc__ = """Insert the item item into list list in front of index index . Return 0 if successful; return -1 and set an exception if unsuccessful.
Analogous to list.insert(index, item) . Changed in version 2.5: This function used an c_int for index . This might require
changes in your code for properly supporting 64-bit systems."""
dll.PyList_Append.restype = c_int
dll.PyList_Append.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyList_Append.__doc__ = """Append the object item at the end of list list . Return 0 if
successful; return -1 and set an exception if unsuccessful. Analogous
to list.append(item) ."""
dll.PyList_GetSlice.restype = POINTER(PyObject)
dll.PyList_GetSlice.argtypes = [ POINTER(PyObject), c_ssize_t, c_ssize_t ]
dll.PyList_GetSlice.__doc__ = """Return value: New reference. Return a list of the objects in list containing the objects between low and high . Return NULL and set an exception if unsuccessful. Analogous
to list[low:high] . Negative indices, as when slicing from Python, are not
supported. Changed in version 2.5: This function used an c_int for low and high . This might
require changes in your code for properly supporting 64-bit systems."""
dll.PyList_SetSlice.restype = c_int
dll.PyList_SetSlice.argtypes = [ POINTER(PyObject), c_ssize_t, c_ssize_t, POINTER(PyObject) ]
dll.PyList_SetSlice.__doc__ = """Set the slice of list between low and high to the contents of itemlist . Analogous to list[low:high] = itemlist . The itemlist may
be NULL , indicating the assignment of an empty list (slice deletion).
Return 0 on success, -1 on failure. Negative indices, as when
slicing from Python, are not supported. Changed in version 2.5: This function used an c_int for low and high . This might
require changes in your code for properly supporting 64-bit systems."""
dll.PyList_Sort.restype = c_int
dll.PyList_Sort.argtypes = [ POINTER(PyObject) ]
dll.PyList_Sort.__doc__ = """Sort the items of list in place. Return 0 on success, -1 on
failure. This is equivalent to list.sort() ."""
dll.PyList_Reverse.restype = c_int
dll.PyList_Reverse.argtypes = [ POINTER(PyObject) ]
dll.PyList_Reverse.__doc__ = """Reverse the items of list in place. Return 0 on success, -1 on
failure. This is the equivalent of list.reverse() ."""
dll.PyList_AsTuple.restype = POINTER(PyObject)
dll.PyList_AsTuple.argtypes = [ POINTER(PyObject) ]
dll.PyList_AsTuple.__doc__ = """Return value: New reference. Return a new tuple object containing the contents of list ; equivalent to tuple(list) ."""
dll._PyList_Extend.restype = POINTER(PyObject)
dll._PyList_Extend.argtypes = [ POINTER(py_object), POINTER(PyObject) ]
dll.PyDict_New.restype = POINTER(PyObject)
dll.PyDict_New.argtypes = [ ]
dll.PyDict_New.__doc__ = """Return value: New reference. Return a new empty dictionary, or NULL on failure."""
dll.PyDict_GetItem.restype = POINTER(PyObject)
dll.PyDict_GetItem.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyDict_GetItem.__doc__ = """Return value: Borrowed reference. Return the object from dictionary p which has a key key . Return NULL if the key key is not present, but without setting an exception."""
dll.PyDict_SetItem.restype = c_int
dll.PyDict_SetItem.argtypes = [ POINTER(PyObject), POINTER(PyObject), POINTER(PyObject) ]
dll.PyDict_SetItem.__doc__ = """Insert value into the dictionary p with a key of key . key must be hashable ; if it isn't, TypeError will be raised. Return 0 on success or -1 on failure."""
dll.PyDict_DelItem.restype = c_int
dll.PyDict_DelItem.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyDict_DelItem.__doc__ = """Remove the entry in dictionary p with key key . key must be hashable;
if it isn't, TypeError is raised. Return 0 on success or -1 on failure."""
dll.PyDict_Clear.restype = None
dll.PyDict_Clear.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Clear.__doc__ = """Empty an existing dictionary of all key-value pairs."""
dll.PyDict_Next.restype = c_int
dll.PyDict_Next.argtypes = [ POINTER(PyObject), POINTER(c_ssize_t), POINTER(POINTER(PyObject)), POINTER(POINTER(PyObject)) ]
dll.PyDict_Next.__doc__ = """Iterate over all key-value pairs in the dictionary p . The Py_ssize_t referred to by ppos must be initialized to 0 prior to the first call to this function to start the iteration; the
function returns true for each pair in the dictionary, and false once all
pairs have been reported. The parameters pkey and pvalue should either
point to PyObject* variables that will be filled in with each key
and value, respectively, or may be NULL . Any references returned through
them are borrowed. ppos should not be altered during iteration. Its
value represents offsets within the internal dictionary structure, and
since the structure is sparse, the offsets are not consecutive. For example: PyObject * key , * value ; Py_ssize_t pos = 0 ; while ( PyDict_Next ( self -> dict , & pos , & key , & value )) { /* do something interesting with the values... */ ... } The dictionary p should not be mutated during iteration. It is safe
(since Python 2.1) to modify the values of the keys as you iterate over the
dictionary, but only so long as the set of keys does not change. For
example: PyObject * key , * value ; Py_ssize_t pos = 0 ; while ( PyDict_Next ( self -> dict , & pos , & key , & value )) { c_int i = PyInt_AS_LONG ( value ) + 1 ; PyObject * o = PyInt_FromLong ( i ); if ( o == NULL ) return - 1 ; if ( PyDict_SetItem ( self -> dict , key , o ) < 0 ) { Py_DECREF ( o ); return - 1 ; } Py_DECREF ( o ); } Changed in version 2.5: This function used an c_int * type for ppos . This might require
changes in your code for properly supporting 64-bit systems."""
dll._PyDict_Next.restype = c_int
dll._PyDict_Next.argtypes = [ POINTER(PyObject), POINTER(c_ssize_t), POINTER(POINTER(PyObject)), POINTER(POINTER(PyObject)), POINTER(long) ]
dll.PyDict_Keys.restype = POINTER(PyObject)
dll.PyDict_Keys.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Keys.__doc__ = """Return value: New reference. Return a PyListObject containing all the keys from the dictionary,
as in the dictionary method dict.keys() ."""
dll.PyDict_Values.restype = POINTER(PyObject)
dll.PyDict_Values.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Values.__doc__ = """Return value: New reference. Return a PyListObject containing all the values from the
dictionary p , as in the dictionary method dict.values() ."""
dll.PyDict_Items.restype = POINTER(PyObject)
dll.PyDict_Items.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Items.__doc__ = """Return value: New reference. Return a PyListObject containing all the items from the
dictionary, as in the dictionary method dict.items() ."""
dll.PyDict_Size.restype = c_ssize_t
dll.PyDict_Size.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Size.__doc__ = """Return the number of items in the dictionary. This is equivalent to len(p) on a dictionary. Changed in version 2.5: This function returned an c_int type. This might require changes
in your code for properly supporting 64-bit systems."""
dll.PyDict_Copy.restype = POINTER(PyObject)
dll.PyDict_Copy.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Copy.__doc__ = """Return value: New reference. Return a new dictionary that contains the same key-value pairs as p . New in version 1.6."""
dll.PyDict_Contains.restype = c_int
dll.PyDict_Contains.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyDict_Contains.__doc__ = """Determine if dictionary p contains key . If an item in p is matches key , return 1 , otherwise return 0 . On error, return -1 .
This is equivalent to the Python expression key in p . New in version 2.4."""
dll._PyDict_Contains.restype = c_int
dll._PyDict_Contains.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_long ]
dll._PyDict_NewPresized.restype = POINTER(PyObject)
dll._PyDict_NewPresized.argtypes = [ c_ssize_t ]
dll._PyDict_MaybeUntrack.restype = None
dll._PyDict_MaybeUntrack.argtypes = [ POINTER(PyObject) ]
dll.PyDict_Update.restype = c_int
dll.PyDict_Update.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyDict_Update.__doc__ = """This is the same as PyDict_Merge(a, b, 1) in C, or a.update(b) in
Python. Return 0 on success or -1 if an exception was raised. New in version 2.2."""
dll.PyDict_Merge.restype = c_int
dll.PyDict_Merge.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_int ]
dll.PyDict_Merge.__doc__ = """Iterate over mapping object b adding key-value pairs to dictionary a . b may be a dictionary, or any object supporting PyMapping_Keys() and PyObject_GetItem() . If override is true, existing pairs in a will be replaced if a matching key is found in b , otherwise pairs will
only be added if there is not a matching key in a . Return 0 on
success or -1 if an exception was raised. New in version 2.2."""
dll.PyDict_MergeFromSeq2.restype = c_int
dll.PyDict_MergeFromSeq2.argtypes = [ POINTER(PyObject), POINTER(PyObject), c_int ]
dll.PyDict_MergeFromSeq2.__doc__ = """Update or merge into dictionary a , from the key-value pairs in seq2 . seq2 must be an iterable object producing iterable objects of length 2,
viewed as key-value pairs. In case of duplicate keys, the last wins if override is true, else the first wins. Return 0 on success or -1 if an exception was raised. Equivalent Python (except for the return
value): def PyDict_MergeFromSeq2 ( a , seq2 , override ) : for key , value in seq2 : if override or key not in a : a [ key ] = value New in version 2.2."""
dll.PyDict_GetItemString.restype = POINTER(PyObject)
dll.PyDict_GetItemString.argtypes = [ POINTER(PyObject), c_char_p ]
dll.PyDict_GetItemString.__doc__ = """Return value: Borrowed reference. This is the same as PyDict_GetItem() , but key is specified as a char* , rather than a PyObject* ."""
dll.PyDict_SetItemString.restype = c_int
dll.PyDict_SetItemString.argtypes = [ POINTER(PyObject), c_char_p, POINTER(PyObject) ]
dll.PyDict_SetItemString.__doc__ = """Insert value into the dictionary p using key as a key. key should
be a char* . The key object is created using PyString_FromString(key) . Return 0 on success or -1 on
failure."""
dll.PyDict_DelItemString.restype = c_int
dll.PyDict_DelItemString.argtypes = [ POINTER(PyObject), c_char_p ]
dll.PyDict_DelItemString.__doc__ = """Remove the entry in dictionary p which has a key specified by the string key . Return 0 on success or -1 on failure."""
dll.PySet_New.restype = POINTER(PyObject)
dll.PySet_New.argtypes = [ POINTER(PyObject) ]
dll.PySet_New.__doc__ = """Return value: New reference. Return a new set containing objects returned by the iterable . The iterable may be NULL to create a new empty set. Return the new set on
success or NULL on failure. Raise TypeError if iterable is not
actually iterable. The constructor is also useful for copying a set
( c=set(s) )."""
dll.PyFrozenSet_New.restype = POINTER(PyObject)
dll.PyFrozenSet_New.argtypes = [ POINTER(PyObject) ]
dll.PyFrozenSet_New.__doc__ = """Return value: New reference. Return a new frozenset containing objects returned by the iterable .
The iterable may be NULL to create a new empty frozenset. Return the new
set on success or NULL on failure. Raise TypeError if iterable is
not actually iterable. Changed in version 2.6: Now guaranteed to return a brand-new frozenset . Formerly,
frozensets of zero-length were a singleton. This got in the way of
building-up new frozensets with PySet_Add() ."""
dll.PySet_Size.restype = c_ssize_t
dll.PySet_Size.argtypes = [ POINTER(PyObject) ]
dll.PySet_Size.__doc__ = """Return the length of a set or frozenset object. Equivalent to len(anyset) . Raises a PyExc_SystemError if anyset is not a set , frozenset , or an instance of a subtype. Changed in version 2.5: This function returned an c_int . This might require changes in
your code for properly supporting 64-bit systems."""
dll.PySet_Clear.restype = c_int
dll.PySet_Clear.argtypes = [ POINTER(PyObject) ]
dll.PySet_Clear.__doc__ = """Empty an existing set of all elements."""
dll.PySet_Contains.restype = c_int
dll.PySet_Contains.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PySet_Contains.__doc__ = """Return 1 if found, 0 if not found, and -1 if an error is encountered. Unlike
the Python __contains__() method, this function does not automatically
convert unhashable sets into temporary frozensets. Raise a TypeError if
the key is unhashable. Raise PyExc_SystemError if anyset is not a set , frozenset , or an instance of a subtype."""
dll.PySet_Discard.restype = c_int
dll.PySet_Discard.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PySet_Discard.__doc__ = """Return 1 if found and removed, 0 if not found (no action taken), and -1 if an
error is encountered. Does not raise KeyError for missing keys. Raise a TypeError if the key is unhashable. Unlike the Python discard() method, this function does not automatically convert unhashable sets into
temporary frozensets. Raise PyExc_SystemError if set is an not an
instance of set or its subtype."""
dll.PySet_Add.restype = c_int
dll.PySet_Add.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PySet_Add.__doc__ = """Add key to a set instance. Does not apply to frozenset instances. Return 0 on success or -1 on failure. Raise a TypeError if
the key is unhashable. Raise a MemoryError if there is no room to grow.
Raise a SystemError if set is an not an instance of set or its
subtype. Changed in version 2.6: Now works with instances of frozenset or its subtypes.
Like PyTuple_SetItem() in that it can be used to fill-in the
values of brand new frozensets before they are exposed to other code."""
dll._PySet_Next.restype = c_int
dll._PySet_Next.argtypes = [ POINTER(PyObject), POINTER(c_ssize_t), POINTER(POINTER(PyObject)) ]
dll._PySet_NextEntry.restype = c_int
dll._PySet_NextEntry.argtypes = [ POINTER(PyObject), POINTER(c_ssize_t), POINTER(POINTER(PyObject)), POINTER(long) ]
dll.PySet_Pop.restype = POINTER(PyObject)
dll.PySet_Pop.argtypes = [ POINTER(PyObject) ]
dll.PySet_Pop.__doc__ = """Return value: New reference. Return a new reference to an arbitrary object in the set , and removes the
object from the set . Return NULL on failure. Raise KeyError if the
set is empty. Raise a SystemError if set is an not an instance of set or its subtype."""
dll._PySet_Update.restype = c_int
dll._PySet_Update.argtypes = [ POINTER(PyObject), POINTER(PyObject) ]
dll.PyCFunction_GetFunction.restype = py_object
dll.PyCFunction_GetFunction.argtypes = [ POINTER(PyObject) ]
dll.PyCFunction_GetSelf.restype = POINTER(PyObject)
dll.PyCFunction_GetSelf.argtypes = [ POINTER(PyObject) ]
dll.PyCFunction_GetFlags.restype = c_int
dll.PyCFunction_GetFlags.argtypes = [ POINTER(PyObject) ]
dll.PyCFunction_Call.restype = POINTER(PyObject)
dll.PyCFunction_Call.argtypes = [ POINTER(PyObject), POINTER(PyObject), POINTER(PyObject) ]
dll.Py_FindMethod.restype = POINTER(PyObject)
dll.Py_FindMethod.argtypes = [ py_object, POINTER(PyObject), c_char_p ]
dll.Py_FindMethod.__doc__ = """Return value: New reference. Return a bound method object for an extension type implemented in C. This
can be useful in the implementation of a tp_getattro or tp_getattr handler that does not use the PyObject_GenericGetAttr() function."""
dll.PyCFunction_NewEx.restype = POINTER(PyObject)
dll.PyCFunction_NewEx.argtypes = [ POINTER(py_object), POINTER(PyObject), POINTER(PyObject) ]
dll.Py_FindMethodInChain.restype = POINTER(PyObject)
dll.Py_FindMethodInChain.argtypes = [ POINTER(py_object), POINTER(PyObject), c_char_p ]
dll.PyCFunction_ClearFreeList.restype = c_int
dll.PyCFunction_ClearFreeList.argtypes = [ ]
dll.PyModule_New.restype = POINTER(PyObject)
dll.PyModule_New.argtypes = [ c_char_p ]
dll.PyModule_New.__doc__ = """Return value: New reference. Return a new module object with the __name__ attribute set to name .
Only the module's __doc__ and __name__ attributes are filled in;
the caller is responsible for providing a __file__ attribute."""
dll.PyModule_GetDict.restype = POINTER(PyObject)
dll.PyModule_GetDict.argtypes = [ POINTER(PyObject) ]
dll.PyModule_GetDict.__doc__ = """Return value: Borrowed reference. Return the dictionary object that implements module 's namespace; this object
is the same as the __dict__ attribute of the module object. This
function never fails. It is recommended extensions use other PyModule_*() and PyObject_*() functions rather than directly
manipulate a module's __dict__ ."""
dll.PyModule_GetName.restype = c_char_p
dll.PyModule_GetName.argtypes = [ POINTER(PyObject) ]
dll.PyModule_GetName.__doc__ = """Return module 's __name__ value. If the module does not provide one,
or if it is not a string, SystemError is raised and NULL is returned."""
dll.PyModule_GetFilename.restype = c_char_p
dll.PyModule_GetFilename.argtypes = [ POINTER(PyObject) ]