Debian Codegraph @

Lib/test/test_stable_abi_ctypes.py

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