1
2# Generated by Tools/scripts/stable_abi.py
3
4"""Test that all symbols of the Stable ABI are accessible using ctypes
5"""
6
7import sys
8import unittest
9from test.support.import_helper import import_module
10from _testcapi import get_feature_macros
11
12feature_macros = get_feature_macros()
13ctypes_test = import_module('ctypes')
14
15class TestStableABIAvailability(unittest.TestCase):
16    def test_available_symbols(self):
17
18        for symbol_name in SYMBOL_NAMES:
19            with self.subTest(symbol_name):
20                ctypes_test.pythonapi[symbol_name]
21
22    def test_feature_macros(self):
23        self.assertEqual(
24            set(get_feature_macros()), EXPECTED_FEATURE_MACROS)
25
26    # The feature macros for Windows are used in creating the DLL
27    # definition, so they must be known on all platforms.
28    # If we are on Windows, we check that the hardcoded data matches
29    # the reality.
30    @unittest.skipIf(sys.platform != "win32", "Windows specific test")
31    def test_windows_feature_macros(self):
32        for name, value in WINDOWS_FEATURE_MACROS.items():
33            if value != 'maybe':
34                with self.subTest(name):
35                    self.assertEqual(feature_macros[name], value)
36
37SYMBOL_NAMES = (
38
39    "PyAIter_Check",
40    "PyArg_Parse",
41    "PyArg_ParseTuple",
42    "PyArg_ParseTupleAndKeywords",
43    "PyArg_UnpackTuple",
44    "PyArg_VaParse",
45    "PyArg_VaParseTupleAndKeywords",
46    "PyArg_ValidateKeywordArguments",
47    "PyBaseObject_Type",
48    "PyBool_FromLong",
49    "PyBool_Type",
50    "PyBuffer_FillContiguousStrides",
51    "PyBuffer_FillInfo",
52    "PyBuffer_FromContiguous",
53    "PyBuffer_GetPointer",
54    "PyBuffer_IsContiguous",
55    "PyBuffer_Release",
56    "PyBuffer_SizeFromFormat",
57    "PyBuffer_ToContiguous",
58    "PyByteArrayIter_Type",
59    "PyByteArray_AsString",
60    "PyByteArray_Concat",
61    "PyByteArray_FromObject",
62    "PyByteArray_FromStringAndSize",
63    "PyByteArray_Resize",
64    "PyByteArray_Size",
65    "PyByteArray_Type",
66    "PyBytesIter_Type",
67    "PyBytes_AsString",
68    "PyBytes_AsStringAndSize",
69    "PyBytes_Concat",
70    "PyBytes_ConcatAndDel",
71    "PyBytes_DecodeEscape",
72    "PyBytes_FromFormat",
73    "PyBytes_FromFormatV",
74    "PyBytes_FromObject",
75    "PyBytes_FromString",
76    "PyBytes_FromStringAndSize",
77    "PyBytes_Repr",
78    "PyBytes_Size",
79    "PyBytes_Type",
80    "PyCFunction_Call",
81    "PyCFunction_GetFlags",
82    "PyCFunction_GetFunction",
83    "PyCFunction_GetSelf",
84    "PyCFunction_New",
85    "PyCFunction_NewEx",
86    "PyCFunction_Type",
87    "PyCMethod_New",
88    "PyCallIter_New",
89    "PyCallIter_Type",
90    "PyCallable_Check",
91    "PyCapsule_GetContext",
92    "PyCapsule_GetDestructor",
93    "PyCapsule_GetName",
94    "PyCapsule_GetPointer",
95    "PyCapsule_Import",
96    "PyCapsule_IsValid",
97    "PyCapsule_New",
98    "PyCapsule_SetContext",
99    "PyCapsule_SetDestructor",
100    "PyCapsule_SetName",
101    "PyCapsule_SetPointer",
102    "PyCapsule_Type",
103    "PyClassMethodDescr_Type",
104    "PyCodec_BackslashReplaceErrors",
105    "PyCodec_Decode",
106    "PyCodec_Decoder",
107    "PyCodec_Encode",
108    "PyCodec_Encoder",
109    "PyCodec_IgnoreErrors",
110    "PyCodec_IncrementalDecoder",
111    "PyCodec_IncrementalEncoder",
112    "PyCodec_KnownEncoding",
113    "PyCodec_LookupError",
114    "PyCodec_NameReplaceErrors",
115    "PyCodec_Register",
116    "PyCodec_RegisterError",
117    "PyCodec_ReplaceErrors",
118    "PyCodec_StreamReader",
119    "PyCodec_StreamWriter",
120    "PyCodec_StrictErrors",
121    "PyCodec_Unregister",
122    "PyCodec_XMLCharRefReplaceErrors",
123    "PyComplex_FromDoubles",
124    "PyComplex_ImagAsDouble",
125    "PyComplex_RealAsDouble",
126    "PyComplex_Type",
127    "PyDescr_NewClassMethod",
128    "PyDescr_NewGetSet",
129    "PyDescr_NewMember",
130    "PyDescr_NewMethod",
131    "PyDictItems_Type",
132    "PyDictIterItem_Type",
133    "PyDictIterKey_Type",
134    "PyDictIterValue_Type",
135    "PyDictKeys_Type",
136    "PyDictProxy_New",
137    "PyDictProxy_Type",
138    "PyDictRevIterItem_Type",
139    "PyDictRevIterKey_Type",
140    "PyDictRevIterValue_Type",
141    "PyDictValues_Type",
142    "PyDict_Clear",
143    "PyDict_Contains",
144    "PyDict_Copy",
145    "PyDict_DelItem",
146    "PyDict_DelItemString",
147    "PyDict_GetItem",
148    "PyDict_GetItemString",
149    "PyDict_GetItemWithError",
150    "PyDict_Items",
151    "PyDict_Keys",
152    "PyDict_Merge",
153    "PyDict_MergeFromSeq2",
154    "PyDict_New",
155    "PyDict_Next",
156    "PyDict_SetItem",
157    "PyDict_SetItemString",
158    "PyDict_Size",
159    "PyDict_Type",
160    "PyDict_Update",
161    "PyDict_Values",
162    "PyEllipsis_Type",
163    "PyEnum_Type",
164    "PyErr_BadArgument",
165    "PyErr_BadInternalCall",
166    "PyErr_CheckSignals",
167    "PyErr_Clear",
168    "PyErr_Display",
169    "PyErr_ExceptionMatches",
170    "PyErr_Fetch",
171    "PyErr_Format",
172    "PyErr_FormatV",
173    "PyErr_GetExcInfo",
174    "PyErr_GetHandledException",
175    "PyErr_GivenExceptionMatches",
176    "PyErr_NewException",
177    "PyErr_NewExceptionWithDoc",
178    "PyErr_NoMemory",
179    "PyErr_NormalizeException",
180    "PyErr_Occurred",
181    "PyErr_Print",
182    "PyErr_PrintEx",
183    "PyErr_ProgramText",
184    "PyErr_ResourceWarning",
185    "PyErr_Restore",
186    "PyErr_SetExcInfo",
187    "PyErr_SetFromErrno",
188    "PyErr_SetFromErrnoWithFilename",
189    "PyErr_SetFromErrnoWithFilenameObject",
190    "PyErr_SetFromErrnoWithFilenameObjects",
191    "PyErr_SetHandledException",
192    "PyErr_SetImportError",
193    "PyErr_SetImportErrorSubclass",
194    "PyErr_SetInterrupt",
195    "PyErr_SetInterruptEx",
196    "PyErr_SetNone",
197    "PyErr_SetObject",
198    "PyErr_SetString",
199    "PyErr_SyntaxLocation",
200    "PyErr_SyntaxLocationEx",
201    "PyErr_WarnEx",
202    "PyErr_WarnExplicit",
203    "PyErr_WarnFormat",
204    "PyErr_WriteUnraisable",
205    "PyEval_AcquireLock",
206    "PyEval_AcquireThread",
207    "PyEval_CallFunction",
208    "PyEval_CallMethod",
209    "PyEval_CallObjectWithKeywords",
210    "PyEval_EvalCode",
211    "PyEval_EvalCodeEx",
212    "PyEval_EvalFrame",
213    "PyEval_EvalFrameEx",
214    "PyEval_GetBuiltins",
215    "PyEval_GetFrame",
216    "PyEval_GetFuncDesc",
217    "PyEval_GetFuncName",
218    "PyEval_GetGlobals",
219    "PyEval_GetLocals",
220    "PyEval_InitThreads",
221    "PyEval_ReleaseLock",
222    "PyEval_ReleaseThread",
223    "PyEval_RestoreThread",
224    "PyEval_SaveThread",
225    "PyEval_ThreadsInitialized",
226    "PyExc_ArithmeticError",
227    "PyExc_AssertionError",
228    "PyExc_AttributeError",
229    "PyExc_BaseException",
230    "PyExc_BaseExceptionGroup",
231    "PyExc_BlockingIOError",
232    "PyExc_BrokenPipeError",
233    "PyExc_BufferError",
234    "PyExc_BytesWarning",
235    "PyExc_ChildProcessError",
236    "PyExc_ConnectionAbortedError",
237    "PyExc_ConnectionError",
238    "PyExc_ConnectionRefusedError",
239    "PyExc_ConnectionResetError",
240    "PyExc_DeprecationWarning",
241    "PyExc_EOFError",
242    "PyExc_EncodingWarning",
243    "PyExc_EnvironmentError",
244    "PyExc_Exception",
245    "PyExc_FileExistsError",
246    "PyExc_FileNotFoundError",
247    "PyExc_FloatingPointError",
248    "PyExc_FutureWarning",
249    "PyExc_GeneratorExit",
250    "PyExc_IOError",
251    "PyExc_ImportError",
252    "PyExc_ImportWarning",
253    "PyExc_IndentationError",
254    "PyExc_IndexError",
255    "PyExc_InterruptedError",
256    "PyExc_IsADirectoryError",
257    "PyExc_KeyError",
258    "PyExc_KeyboardInterrupt",
259    "PyExc_LookupError",
260    "PyExc_MemoryError",
261    "PyExc_ModuleNotFoundError",
262    "PyExc_NameError",
263    "PyExc_NotADirectoryError",
264    "PyExc_NotImplementedError",
265    "PyExc_OSError",
266    "PyExc_OverflowError",
267    "PyExc_PendingDeprecationWarning",
268    "PyExc_PermissionError",
269    "PyExc_ProcessLookupError",
270    "PyExc_RecursionError",
271    "PyExc_ReferenceError",
272    "PyExc_ResourceWarning",
273    "PyExc_RuntimeError",
274    "PyExc_RuntimeWarning",
275    "PyExc_StopAsyncIteration",
276    "PyExc_StopIteration",
277    "PyExc_SyntaxError",
278    "PyExc_SyntaxWarning",
279    "PyExc_SystemError",
280    "PyExc_SystemExit",
281    "PyExc_TabError",
282    "PyExc_TimeoutError",
283    "PyExc_TypeError",
284    "PyExc_UnboundLocalError",
285    "PyExc_UnicodeDecodeError",
286    "PyExc_UnicodeEncodeError",
287    "PyExc_UnicodeError",
288    "PyExc_UnicodeTranslateError",
289    "PyExc_UnicodeWarning",
290    "PyExc_UserWarning",
291    "PyExc_ValueError",
292    "PyExc_Warning",
293    "PyExc_ZeroDivisionError",
294    "PyExceptionClass_Name",
295    "PyException_GetCause",
296    "PyException_GetContext",
297    "PyException_GetTraceback",
298    "PyException_SetCause",
299    "PyException_SetContext",
300    "PyException_SetTraceback",
301    "PyFile_FromFd",
302    "PyFile_GetLine",
303    "PyFile_WriteObject",
304    "PyFile_WriteString",
305    "PyFilter_Type",
306    "PyFloat_AsDouble",
307    "PyFloat_FromDouble",
308    "PyFloat_FromString",
309    "PyFloat_GetInfo",
310    "PyFloat_GetMax",
311    "PyFloat_GetMin",
312    "PyFloat_Type",
313    "PyFrame_GetCode",
314    "PyFrame_GetLineNumber",
315    "PyFrozenSet_New",
316    "PyFrozenSet_Type",
317    "PyGC_Collect",
318    "PyGC_Disable",
319    "PyGC_Enable",
320    "PyGC_IsEnabled",
321    "PyGILState_Ensure",
322    "PyGILState_GetThisThreadState",
323    "PyGILState_Release",
324    "PyGetSetDescr_Type",
325    "PyImport_AddModule",
326    "PyImport_AddModuleObject",
327    "PyImport_AppendInittab",
328    "PyImport_ExecCodeModule",
329    "PyImport_ExecCodeModuleEx",
330    "PyImport_ExecCodeModuleObject",
331    "PyImport_ExecCodeModuleWithPathnames",
332    "PyImport_GetImporter",
333    "PyImport_GetMagicNumber",
334    "PyImport_GetMagicTag",
335    "PyImport_GetModule",
336    "PyImport_GetModuleDict",
337    "PyImport_Import",
338    "PyImport_ImportFrozenModule",
339    "PyImport_ImportFrozenModuleObject",
340    "PyImport_ImportModule",
341    "PyImport_ImportModuleLevel",
342    "PyImport_ImportModuleLevelObject",
343    "PyImport_ImportModuleNoBlock",
344    "PyImport_ReloadModule",
345    "PyIndex_Check",
346    "PyInterpreterState_Clear",
347    "PyInterpreterState_Delete",
348    "PyInterpreterState_Get",
349    "PyInterpreterState_GetDict",
350    "PyInterpreterState_GetID",
351    "PyInterpreterState_New",
352    "PyIter_Check",
353    "PyIter_Next",
354    "PyIter_Send",
355    "PyListIter_Type",
356    "PyListRevIter_Type",
357    "PyList_Append",
358    "PyList_AsTuple",
359    "PyList_GetItem",
360    "PyList_GetSlice",
361    "PyList_Insert",
362    "PyList_New",
363    "PyList_Reverse",
364    "PyList_SetItem",
365    "PyList_SetSlice",
366    "PyList_Size",
367    "PyList_Sort",
368    "PyList_Type",
369    "PyLongRangeIter_Type",
370    "PyLong_AsDouble",
371    "PyLong_AsLong",
372    "PyLong_AsLongAndOverflow",
373    "PyLong_AsLongLong",
374    "PyLong_AsLongLongAndOverflow",
375    "PyLong_AsSize_t",
376    "PyLong_AsSsize_t",
377    "PyLong_AsUnsignedLong",
378    "PyLong_AsUnsignedLongLong",
379    "PyLong_AsUnsignedLongLongMask",
380    "PyLong_AsUnsignedLongMask",
381    "PyLong_AsVoidPtr",
382    "PyLong_FromDouble",
383    "PyLong_FromLong",
384    "PyLong_FromLongLong",
385    "PyLong_FromSize_t",
386    "PyLong_FromSsize_t",
387    "PyLong_FromString",
388    "PyLong_FromUnsignedLong",
389    "PyLong_FromUnsignedLongLong",
390    "PyLong_FromVoidPtr",
391    "PyLong_GetInfo",
392    "PyLong_Type",
393    "PyMap_Type",
394    "PyMapping_Check",
395    "PyMapping_GetItemString",
396    "PyMapping_HasKey",
397    "PyMapping_HasKeyString",
398    "PyMapping_Items",
399    "PyMapping_Keys",
400    "PyMapping_Length",
401    "PyMapping_SetItemString",
402    "PyMapping_Size",
403    "PyMapping_Values",
404    "PyMarshal_ReadObjectFromString",
405    "PyMarshal_WriteObjectToString",
406    "PyMem_Calloc",
407    "PyMem_Free",
408    "PyMem_Malloc",
409    "PyMem_Realloc",
410    "PyMemberDescr_Type",
411    "PyMember_GetOne",
412    "PyMember_SetOne",
413    "PyMemoryView_FromBuffer",
414    "PyMemoryView_FromMemory",
415    "PyMemoryView_FromObject",
416    "PyMemoryView_GetContiguous",
417    "PyMemoryView_Type",
418    "PyMethodDescr_Type",
419    "PyModuleDef_Init",
420    "PyModuleDef_Type",
421    "PyModule_AddFunctions",
422    "PyModule_AddIntConstant",
423    "PyModule_AddObject",
424    "PyModule_AddObjectRef",
425    "PyModule_AddStringConstant",
426    "PyModule_AddType",
427    "PyModule_ExecDef",
428    "PyModule_GetDef",
429    "PyModule_GetDict",
430    "PyModule_GetFilename",
431    "PyModule_GetFilenameObject",
432    "PyModule_GetName",
433    "PyModule_GetNameObject",
434    "PyModule_GetState",
435    "PyModule_New",
436    "PyModule_NewObject",
437    "PyModule_SetDocString",
438    "PyModule_Type",
439    "PyNumber_Absolute",
440    "PyNumber_Add",
441    "PyNumber_And",
442    "PyNumber_AsSsize_t",
443    "PyNumber_Check",
444    "PyNumber_Divmod",
445    "PyNumber_Float",
446    "PyNumber_FloorDivide",
447    "PyNumber_InPlaceAdd",
448    "PyNumber_InPlaceAnd",
449    "PyNumber_InPlaceFloorDivide",
450    "PyNumber_InPlaceLshift",
451    "PyNumber_InPlaceMatrixMultiply",
452    "PyNumber_InPlaceMultiply",
453    "PyNumber_InPlaceOr",
454    "PyNumber_InPlacePower",
455    "PyNumber_InPlaceRemainder",
456    "PyNumber_InPlaceRshift",
457    "PyNumber_InPlaceSubtract",
458    "PyNumber_InPlaceTrueDivide",
459    "PyNumber_InPlaceXor",
460    "PyNumber_Index",
461    "PyNumber_Invert",
462    "PyNumber_Long",
463    "PyNumber_Lshift",
464    "PyNumber_MatrixMultiply",
465    "PyNumber_Multiply",
466    "PyNumber_Negative",
467    "PyNumber_Or",
468    "PyNumber_Positive",
469    "PyNumber_Power",
470    "PyNumber_Remainder",
471    "PyNumber_Rshift",
472    "PyNumber_Subtract",
473    "PyNumber_ToBase",
474    "PyNumber_TrueDivide",
475    "PyNumber_Xor",
476    "PyOS_FSPath",
477    "PyOS_InputHook",
478    "PyOS_InterruptOccurred",
479    "PyOS_double_to_string",
480    "PyOS_getsig",
481    "PyOS_mystricmp",
482    "PyOS_mystrnicmp",
483    "PyOS_setsig",
484    "PyOS_snprintf",
485    "PyOS_string_to_double",
486    "PyOS_strtol",
487    "PyOS_strtoul",
488    "PyOS_vsnprintf",
489    "PyObject_ASCII",
490    "PyObject_AsCharBuffer",
491    "PyObject_AsFileDescriptor",
492    "PyObject_AsReadBuffer",
493    "PyObject_AsWriteBuffer",
494    "PyObject_Bytes",
495    "PyObject_Call",
496    "PyObject_CallFunction",
497    "PyObject_CallFunctionObjArgs",
498    "PyObject_CallMethod",
499    "PyObject_CallMethodObjArgs",
500    "PyObject_CallNoArgs",
501    "PyObject_CallObject",
502    "PyObject_Calloc",
503    "PyObject_CheckBuffer",
504    "PyObject_CheckReadBuffer",
505    "PyObject_ClearWeakRefs",
506    "PyObject_CopyData",
507    "PyObject_DelItem",
508    "PyObject_DelItemString",
509    "PyObject_Dir",
510    "PyObject_Format",
511    "PyObject_Free",
512    "PyObject_GC_Del",
513    "PyObject_GC_IsFinalized",
514    "PyObject_GC_IsTracked",
515    "PyObject_GC_Track",
516    "PyObject_GC_UnTrack",
517    "PyObject_GenericGetAttr",
518    "PyObject_GenericGetDict",
519    "PyObject_GenericSetAttr",
520    "PyObject_GenericSetDict",
521    "PyObject_GetAIter",
522    "PyObject_GetAttr",
523    "PyObject_GetAttrString",
524    "PyObject_GetBuffer",
525    "PyObject_GetItem",
526    "PyObject_GetIter",
527    "PyObject_HasAttr",
528    "PyObject_HasAttrString",
529    "PyObject_Hash",
530    "PyObject_HashNotImplemented",
531    "PyObject_Init",
532    "PyObject_InitVar",
533    "PyObject_IsInstance",
534    "PyObject_IsSubclass",
535    "PyObject_IsTrue",
536    "PyObject_Length",
537    "PyObject_Malloc",
538    "PyObject_Not",
539    "PyObject_Realloc",
540    "PyObject_Repr",
541    "PyObject_RichCompare",
542    "PyObject_RichCompareBool",
543    "PyObject_SelfIter",
544    "PyObject_SetAttr",
545    "PyObject_SetAttrString",
546    "PyObject_SetItem",
547    "PyObject_Size",
548    "PyObject_Str",
549    "PyObject_Type",
550    "PyProperty_Type",
551    "PyRangeIter_Type",
552    "PyRange_Type",
553    "PyReversed_Type",
554    "PySeqIter_New",
555    "PySeqIter_Type",
556    "PySequence_Check",
557    "PySequence_Concat",
558    "PySequence_Contains",
559    "PySequence_Count",
560    "PySequence_DelItem",
561    "PySequence_DelSlice",
562    "PySequence_Fast",
563    "PySequence_GetItem",
564    "PySequence_GetSlice",
565    "PySequence_In",
566    "PySequence_InPlaceConcat",
567    "PySequence_InPlaceRepeat",
568    "PySequence_Index",
569    "PySequence_Length",
570    "PySequence_List",
571    "PySequence_Repeat",
572    "PySequence_SetItem",
573    "PySequence_SetSlice",
574    "PySequence_Size",
575    "PySequence_Tuple",
576    "PySetIter_Type",
577    "PySet_Add",
578    "PySet_Clear",
579    "PySet_Contains",
580    "PySet_Discard",
581    "PySet_New",
582    "PySet_Pop",
583    "PySet_Size",
584    "PySet_Type",
585    "PySlice_AdjustIndices",
586    "PySlice_GetIndices",
587    "PySlice_GetIndicesEx",
588    "PySlice_New",
589    "PySlice_Type",
590    "PySlice_Unpack",
591    "PyState_AddModule",
592    "PyState_FindModule",
593    "PyState_RemoveModule",
594    "PyStructSequence_GetItem",
595    "PyStructSequence_New",
596    "PyStructSequence_NewType",
597    "PyStructSequence_SetItem",
598    "PyStructSequence_UnnamedField",
599    "PySuper_Type",
600    "PySys_AddWarnOption",
601    "PySys_AddWarnOptionUnicode",
602    "PySys_AddXOption",
603    "PySys_FormatStderr",
604    "PySys_FormatStdout",
605    "PySys_GetObject",
606    "PySys_GetXOptions",
607    "PySys_HasWarnOptions",
608    "PySys_ResetWarnOptions",
609    "PySys_SetArgv",
610    "PySys_SetArgvEx",
611    "PySys_SetObject",
612    "PySys_SetPath",
613    "PySys_WriteStderr",
614    "PySys_WriteStdout",
615    "PyThreadState_Clear",
616    "PyThreadState_Delete",
617    "PyThreadState_DeleteCurrent",
618    "PyThreadState_Get",
619    "PyThreadState_GetDict",
620    "PyThreadState_GetFrame",
621    "PyThreadState_GetID",
622    "PyThreadState_GetInterpreter",
623    "PyThreadState_New",
624    "PyThreadState_SetAsyncExc",
625    "PyThreadState_Swap",
626    "PyThread_GetInfo",
627    "PyThread_ReInitTLS",
628    "PyThread_acquire_lock",
629    "PyThread_acquire_lock_timed",
630    "PyThread_allocate_lock",
631    "PyThread_create_key",
632    "PyThread_delete_key",
633    "PyThread_delete_key_value",
634    "PyThread_exit_thread",
635    "PyThread_free_lock",
636    "PyThread_get_key_value",
637    "PyThread_get_stacksize",
638    "PyThread_get_thread_ident",
639    "PyThread_init_thread",
640    "PyThread_release_lock",
641    "PyThread_set_key_value",
642    "PyThread_set_stacksize",
643    "PyThread_start_new_thread",
644    "PyThread_tss_alloc",
645    "PyThread_tss_create",
646    "PyThread_tss_delete",
647    "PyThread_tss_free",
648    "PyThread_tss_get",
649    "PyThread_tss_is_created",
650    "PyThread_tss_set",
651    "PyTraceBack_Here",
652    "PyTraceBack_Print",
653    "PyTraceBack_Type",
654    "PyTupleIter_Type",
655    "PyTuple_GetItem",
656    "PyTuple_GetSlice",
657    "PyTuple_New",
658    "PyTuple_Pack",
659    "PyTuple_SetItem",
660    "PyTuple_Size",
661    "PyTuple_Type",
662    "PyType_ClearCache",
663    "PyType_FromModuleAndSpec",
664    "PyType_FromSpec",
665    "PyType_FromSpecWithBases",
666    "PyType_GenericAlloc",
667    "PyType_GenericNew",
668    "PyType_GetFlags",
669    "PyType_GetModule",
670    "PyType_GetModuleState",
671    "PyType_GetName",
672    "PyType_GetQualName",
673    "PyType_GetSlot",
674    "PyType_IsSubtype",
675    "PyType_Modified",
676    "PyType_Ready",
677    "PyType_Type",
678    "PyUnicodeDecodeError_Create",
679    "PyUnicodeDecodeError_GetEncoding",
680    "PyUnicodeDecodeError_GetEnd",
681    "PyUnicodeDecodeError_GetObject",
682    "PyUnicodeDecodeError_GetReason",
683    "PyUnicodeDecodeError_GetStart",
684    "PyUnicodeDecodeError_SetEnd",
685    "PyUnicodeDecodeError_SetReason",
686    "PyUnicodeDecodeError_SetStart",
687    "PyUnicodeEncodeError_GetEncoding",
688    "PyUnicodeEncodeError_GetEnd",
689    "PyUnicodeEncodeError_GetObject",
690    "PyUnicodeEncodeError_GetReason",
691    "PyUnicodeEncodeError_GetStart",
692    "PyUnicodeEncodeError_SetEnd",
693    "PyUnicodeEncodeError_SetReason",
694    "PyUnicodeEncodeError_SetStart",
695    "PyUnicodeIter_Type",
696    "PyUnicodeTranslateError_GetEnd",
697    "PyUnicodeTranslateError_GetObject",
698    "PyUnicodeTranslateError_GetReason",
699    "PyUnicodeTranslateError_GetStart",
700    "PyUnicodeTranslateError_SetEnd",
701    "PyUnicodeTranslateError_SetReason",
702    "PyUnicodeTranslateError_SetStart",
703    "PyUnicode_Append",
704    "PyUnicode_AppendAndDel",
705    "PyUnicode_AsASCIIString",
706    "PyUnicode_AsCharmapString",
707    "PyUnicode_AsDecodedObject",
708    "PyUnicode_AsDecodedUnicode",
709    "PyUnicode_AsEncodedObject",
710    "PyUnicode_AsEncodedString",
711    "PyUnicode_AsEncodedUnicode",
712    "PyUnicode_AsLatin1String",
713    "PyUnicode_AsRawUnicodeEscapeString",
714    "PyUnicode_AsUCS4",
715    "PyUnicode_AsUCS4Copy",
716    "PyUnicode_AsUTF16String",
717    "PyUnicode_AsUTF32String",
718    "PyUnicode_AsUTF8AndSize",
719    "PyUnicode_AsUTF8String",
720    "PyUnicode_AsUnicodeEscapeString",
721    "PyUnicode_AsWideChar",
722    "PyUnicode_AsWideCharString",
723    "PyUnicode_BuildEncodingMap",
724    "PyUnicode_Compare",
725    "PyUnicode_CompareWithASCIIString",
726    "PyUnicode_Concat",
727    "PyUnicode_Contains",
728    "PyUnicode_Count",
729    "PyUnicode_Decode",
730    "PyUnicode_DecodeASCII",
731    "PyUnicode_DecodeCharmap",
732    "PyUnicode_DecodeFSDefault",
733    "PyUnicode_DecodeFSDefaultAndSize",
734    "PyUnicode_DecodeLatin1",
735    "PyUnicode_DecodeLocale",
736    "PyUnicode_DecodeLocaleAndSize",
737    "PyUnicode_DecodeRawUnicodeEscape",
738    "PyUnicode_DecodeUTF16",
739    "PyUnicode_DecodeUTF16Stateful",
740    "PyUnicode_DecodeUTF32",
741    "PyUnicode_DecodeUTF32Stateful",
742    "PyUnicode_DecodeUTF7",
743    "PyUnicode_DecodeUTF7Stateful",
744    "PyUnicode_DecodeUTF8",
745    "PyUnicode_DecodeUTF8Stateful",
746    "PyUnicode_DecodeUnicodeEscape",
747    "PyUnicode_EncodeFSDefault",
748    "PyUnicode_EncodeLocale",
749    "PyUnicode_FSConverter",
750    "PyUnicode_FSDecoder",
751    "PyUnicode_Find",
752    "PyUnicode_FindChar",
753    "PyUnicode_Format",
754    "PyUnicode_FromEncodedObject",
755    "PyUnicode_FromFormat",
756    "PyUnicode_FromFormatV",
757    "PyUnicode_FromObject",
758    "PyUnicode_FromOrdinal",
759    "PyUnicode_FromString",
760    "PyUnicode_FromStringAndSize",
761    "PyUnicode_FromWideChar",
762    "PyUnicode_GetDefaultEncoding",
763    "PyUnicode_GetLength",
764    "PyUnicode_GetSize",
765    "PyUnicode_InternFromString",
766    "PyUnicode_InternImmortal",
767    "PyUnicode_InternInPlace",
768    "PyUnicode_IsIdentifier",
769    "PyUnicode_Join",
770    "PyUnicode_Partition",
771    "PyUnicode_RPartition",
772    "PyUnicode_RSplit",
773    "PyUnicode_ReadChar",
774    "PyUnicode_Replace",
775    "PyUnicode_Resize",
776    "PyUnicode_RichCompare",
777    "PyUnicode_Split",
778    "PyUnicode_Splitlines",
779    "PyUnicode_Substring",
780    "PyUnicode_Tailmatch",
781    "PyUnicode_Translate",
782    "PyUnicode_Type",
783    "PyUnicode_WriteChar",
784    "PyWeakref_GetObject",
785    "PyWeakref_NewProxy",
786    "PyWeakref_NewRef",
787    "PyWrapperDescr_Type",
788    "PyWrapper_New",
789    "PyZip_Type",
790    "Py_AddPendingCall",
791    "Py_AtExit",
792    "Py_BuildValue",
793    "Py_BytesMain",
794    "Py_CompileString",
795    "Py_DecRef",
796    "Py_DecodeLocale",
797    "Py_EncodeLocale",
798    "Py_EndInterpreter",
799    "Py_EnterRecursiveCall",
800    "Py_Exit",
801    "Py_FatalError",
802    "Py_FileSystemDefaultEncodeErrors",
803    "Py_FileSystemDefaultEncoding",
804    "Py_Finalize",
805    "Py_FinalizeEx",
806    "Py_GenericAlias",
807    "Py_GenericAliasType",
808    "Py_GetArgcArgv",
809    "Py_GetBuildInfo",
810    "Py_GetCompiler",
811    "Py_GetCopyright",
812    "Py_GetExecPrefix",
813    "Py_GetPath",
814    "Py_GetPlatform",
815    "Py_GetPrefix",
816    "Py_GetProgramFullPath",
817    "Py_GetProgramName",
818    "Py_GetPythonHome",
819    "Py_GetRecursionLimit",
820    "Py_GetVersion",
821    "Py_HasFileSystemDefaultEncoding",
822    "Py_IncRef",
823    "Py_Initialize",
824    "Py_InitializeEx",
825    "Py_Is",
826    "Py_IsFalse",
827    "Py_IsInitialized",
828    "Py_IsNone",
829    "Py_IsTrue",
830    "Py_LeaveRecursiveCall",
831    "Py_Main",
832    "Py_MakePendingCalls",
833    "Py_NewInterpreter",
834    "Py_NewRef",
835    "Py_ReprEnter",
836    "Py_ReprLeave",
837    "Py_SetPath",
838    "Py_SetProgramName",
839    "Py_SetPythonHome",
840    "Py_SetRecursionLimit",
841    "Py_UTF8Mode",
842    "Py_VaBuildValue",
843    "Py_Version",
844    "Py_XNewRef",
845    "_PyArg_ParseTupleAndKeywords_SizeT",
846    "_PyArg_ParseTuple_SizeT",
847    "_PyArg_Parse_SizeT",
848    "_PyArg_VaParseTupleAndKeywords_SizeT",
849    "_PyArg_VaParse_SizeT",
850    "_PyErr_BadInternalCall",
851    "_PyObject_CallFunction_SizeT",
852    "_PyObject_CallMethod_SizeT",
853    "_PyObject_GC_New",
854    "_PyObject_GC_NewVar",
855    "_PyObject_GC_Resize",
856    "_PyObject_New",
857    "_PyObject_NewVar",
858    "_PyState_AddModule",
859    "_PyThreadState_Init",
860    "_PyThreadState_Prealloc",
861    "_PyWeakref_CallableProxyType",
862    "_PyWeakref_ProxyType",
863    "_PyWeakref_RefType",
864    "_Py_BuildValue_SizeT",
865    "_Py_CheckRecursiveCall",
866    "_Py_Dealloc",
867    "_Py_DecRef",
868    "_Py_EllipsisObject",
869    "_Py_FalseStruct",
870    "_Py_IncRef",
871    "_Py_NoneStruct",
872    "_Py_NotImplementedStruct",
873    "_Py_SwappedOp",
874    "_Py_TrueStruct",
875    "_Py_VaBuildValue_SizeT",
876)
877if feature_macros['MS_WINDOWS']:
878    SYMBOL_NAMES += (
879        'PyErr_SetExcFromWindowsErr',
880        'PyErr_SetExcFromWindowsErrWithFilename',
881        'PyErr_SetExcFromWindowsErrWithFilenameObject',
882        'PyErr_SetExcFromWindowsErrWithFilenameObjects',
883        'PyErr_SetFromWindowsErr',
884        'PyErr_SetFromWindowsErrWithFilename',
885        'PyExc_WindowsError',
886        'PyUnicode_AsMBCSString',
887        'PyUnicode_DecodeCodePageStateful',
888        'PyUnicode_DecodeMBCS',
889        'PyUnicode_DecodeMBCSStateful',
890        'PyUnicode_EncodeCodePage',
891    )
892if feature_macros['HAVE_FORK']:
893    SYMBOL_NAMES += (
894        'PyOS_AfterFork',
895        'PyOS_AfterFork_Child',
896        'PyOS_AfterFork_Parent',
897        'PyOS_BeforeFork',
898    )
899if feature_macros['USE_STACKCHECK']:
900    SYMBOL_NAMES += (
901        'PyOS_CheckStack',
902    )
903if feature_macros['PY_HAVE_THREAD_NATIVE_ID']:
904    SYMBOL_NAMES += (
905        'PyThread_get_thread_native_id',
906    )
907if feature_macros['Py_REF_DEBUG']:
908    SYMBOL_NAMES += (
909        '_Py_NegativeRefcount',
910        '_Py_RefTotal',
911    )
912
913EXPECTED_FEATURE_MACROS = set(['HAVE_FORK',
914 'MS_WINDOWS',
915 'PY_HAVE_THREAD_NATIVE_ID',
916 'Py_REF_DEBUG',
917 'USE_STACKCHECK'])
918WINDOWS_FEATURE_MACROS = {'HAVE_FORK': False,
919 'MS_WINDOWS': True,
920 'PY_HAVE_THREAD_NATIVE_ID': True,
921 'Py_REF_DEBUG': 'maybe',
922 'USE_STACKCHECK': 'maybe'}
923