@@ -327,52 +327,52 @@ typedef struct _typeobject {
327327
328328
329329/* Generic type check */
330- extern DL_IMPORT (int ) PyType_IsSubtype (PyTypeObject * , PyTypeObject * );
330+ PyAPI_FUNC (int ) PyType_IsSubtype (PyTypeObject * , PyTypeObject * );
331331#define PyObject_TypeCheck (ob , tp ) \
332332 ((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))
333333
334- extern DL_IMPORT (PyTypeObject ) PyType_Type ; /* built-in 'type' */
335- extern DL_IMPORT (PyTypeObject ) PyBaseObject_Type ; /* built-in 'object' */
336- extern DL_IMPORT (PyTypeObject ) PySuper_Type ; /* built-in 'super' */
334+ PyAPI_DATA (PyTypeObject ) PyType_Type ; /* built-in 'type' */
335+ PyAPI_DATA (PyTypeObject ) PyBaseObject_Type ; /* built-in 'object' */
336+ PyAPI_DATA (PyTypeObject ) PySuper_Type ; /* built-in 'super' */
337337
338338#define PyType_Check (op ) PyObject_TypeCheck(op, &PyType_Type)
339339#define PyType_CheckExact (op ) ((op)->ob_type == &PyType_Type)
340340
341- extern DL_IMPORT (int ) PyType_Ready (PyTypeObject * );
342- extern DL_IMPORT (PyObject * ) PyType_GenericAlloc (PyTypeObject * , int );
343- extern DL_IMPORT (PyObject * ) PyType_GenericNew (PyTypeObject * ,
341+ PyAPI_FUNC (int ) PyType_Ready (PyTypeObject * );
342+ PyAPI_FUNC (PyObject * ) PyType_GenericAlloc (PyTypeObject * , int );
343+ PyAPI_FUNC (PyObject * ) PyType_GenericNew (PyTypeObject * ,
344344 PyObject * , PyObject * );
345- extern DL_IMPORT (PyObject * ) _PyType_Lookup (PyTypeObject * , PyObject * );
345+ PyAPI_FUNC (PyObject * ) _PyType_Lookup (PyTypeObject * , PyObject * );
346346
347347/* Generic operations on objects */
348- extern DL_IMPORT (int ) PyObject_Print (PyObject * , FILE * , int );
349- extern DL_IMPORT (void ) _PyObject_Dump (PyObject * );
350- extern DL_IMPORT (PyObject * ) PyObject_Repr (PyObject * );
351- extern DL_IMPORT (PyObject * ) PyObject_Str (PyObject * );
348+ PyAPI_FUNC (int ) PyObject_Print (PyObject * , FILE * , int );
349+ PyAPI_FUNC (void ) _PyObject_Dump (PyObject * );
350+ PyAPI_FUNC (PyObject * ) PyObject_Repr (PyObject * );
351+ PyAPI_FUNC (PyObject * ) PyObject_Str (PyObject * );
352352#ifdef Py_USING_UNICODE
353- extern DL_IMPORT (PyObject * ) PyObject_Unicode (PyObject * );
353+ PyAPI_FUNC (PyObject * ) PyObject_Unicode (PyObject * );
354354#endif
355- extern DL_IMPORT (int ) PyObject_Compare (PyObject * , PyObject * );
356- extern DL_IMPORT (PyObject * ) PyObject_RichCompare (PyObject * , PyObject * , int );
357- extern DL_IMPORT (int ) PyObject_RichCompareBool (PyObject * , PyObject * , int );
358- extern DL_IMPORT (PyObject * ) PyObject_GetAttrString (PyObject * , char * );
359- extern DL_IMPORT (int ) PyObject_SetAttrString (PyObject * , char * , PyObject * );
360- extern DL_IMPORT (int ) PyObject_HasAttrString (PyObject * , char * );
361- extern DL_IMPORT (PyObject * ) PyObject_GetAttr (PyObject * , PyObject * );
362- extern DL_IMPORT (int ) PyObject_SetAttr (PyObject * , PyObject * , PyObject * );
363- extern DL_IMPORT (int ) PyObject_HasAttr (PyObject * , PyObject * );
364- extern DL_IMPORT (PyObject * * ) _PyObject_GetDictPtr (PyObject * );
365- extern DL_IMPORT (PyObject * ) PyObject_GenericGetAttr (PyObject * , PyObject * );
366- extern DL_IMPORT (int ) PyObject_GenericSetAttr (PyObject * ,
355+ PyAPI_FUNC (int ) PyObject_Compare (PyObject * , PyObject * );
356+ PyAPI_FUNC (PyObject * ) PyObject_RichCompare (PyObject * , PyObject * , int );
357+ PyAPI_FUNC (int ) PyObject_RichCompareBool (PyObject * , PyObject * , int );
358+ PyAPI_FUNC (PyObject * ) PyObject_GetAttrString (PyObject * , char * );
359+ PyAPI_FUNC (int ) PyObject_SetAttrString (PyObject * , char * , PyObject * );
360+ PyAPI_FUNC (int ) PyObject_HasAttrString (PyObject * , char * );
361+ PyAPI_FUNC (PyObject * ) PyObject_GetAttr (PyObject * , PyObject * );
362+ PyAPI_FUNC (int ) PyObject_SetAttr (PyObject * , PyObject * , PyObject * );
363+ PyAPI_FUNC (int ) PyObject_HasAttr (PyObject * , PyObject * );
364+ PyAPI_FUNC (PyObject * * ) _PyObject_GetDictPtr (PyObject * );
365+ PyAPI_FUNC (PyObject * ) PyObject_GenericGetAttr (PyObject * , PyObject * );
366+ PyAPI_FUNC (int ) PyObject_GenericSetAttr (PyObject * ,
367367 PyObject * , PyObject * );
368- extern DL_IMPORT (long ) PyObject_Hash (PyObject * );
369- extern DL_IMPORT (int ) PyObject_IsTrue (PyObject * );
370- extern DL_IMPORT (int ) PyObject_Not (PyObject * );
371- extern DL_IMPORT (int ) PyCallable_Check (PyObject * );
372- extern DL_IMPORT (int ) PyNumber_Coerce (PyObject * * , PyObject * * );
373- extern DL_IMPORT (int ) PyNumber_CoerceEx (PyObject * * , PyObject * * );
368+ PyAPI_FUNC (long ) PyObject_Hash (PyObject * );
369+ PyAPI_FUNC (int ) PyObject_IsTrue (PyObject * );
370+ PyAPI_FUNC (int ) PyObject_Not (PyObject * );
371+ PyAPI_FUNC (int ) PyCallable_Check (PyObject * );
372+ PyAPI_FUNC (int ) PyNumber_Coerce (PyObject * * , PyObject * * );
373+ PyAPI_FUNC (int ) PyNumber_CoerceEx (PyObject * * , PyObject * * );
374374
375- extern DL_IMPORT (void ) PyObject_ClearWeakRefs (PyObject * );
375+ PyAPI_FUNC (void ) PyObject_ClearWeakRefs (PyObject * );
376376
377377/* A slot function whose address we need to compare */
378378extern int _PyObject_SlotCompare (PyObject * , PyObject * );
@@ -383,16 +383,16 @@ extern int _PyObject_SlotCompare(PyObject *, PyObject *);
383383 returning the names of the current locals. In this case, if there are
384384 no current locals, NULL is returned, and PyErr_Occurred() is false.
385385*/
386- extern DL_IMPORT (PyObject * ) PyObject_Dir (PyObject * );
386+ PyAPI_FUNC (PyObject * ) PyObject_Dir (PyObject * );
387387
388388
389389/* Helpers for printing recursive container types */
390- extern DL_IMPORT (int ) Py_ReprEnter (PyObject * );
391- extern DL_IMPORT (void ) Py_ReprLeave (PyObject * );
390+ PyAPI_FUNC (int ) Py_ReprEnter (PyObject * );
391+ PyAPI_FUNC (void ) Py_ReprLeave (PyObject * );
392392
393393/* Helpers for hash functions */
394- extern DL_IMPORT (long ) _Py_HashDouble (double );
395- extern DL_IMPORT (long ) _Py_HashPointer (void * );
394+ PyAPI_FUNC (long ) _Py_HashDouble (double );
395+ PyAPI_FUNC (long ) _Py_HashPointer (void * );
396396
397397/* Helper for passing objects to printf and the like */
398398#define PyObject_REPR (obj ) PyString_AS_STRING(PyObject_Repr(obj))
@@ -521,8 +521,8 @@ environment the global variable trick is not safe.)
521521 * #ifdefs (we used to do that -- it was impenetrable).
522522 */
523523#ifdef Py_REF_DEBUG
524- extern DL_IMPORT (long ) _Py_RefTotal ;
525- extern DL_IMPORT (void ) _Py_NegativeRefcount (const char * fname ,
524+ PyAPI_DATA (long ) _Py_RefTotal ;
525+ PyAPI_FUNC (void ) _Py_NegativeRefcount (const char * fname ,
526526 int lineno , PyObject * op );
527527#define _Py_INC_REFTOTAL _Py_RefTotal++
528528#define _Py_DEC_REFTOTAL _Py_RefTotal--
@@ -540,7 +540,7 @@ extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname,
540540#endif /* Py_REF_DEBUG */
541541
542542#ifdef COUNT_ALLOCS
543- extern DL_IMPORT (void ) inc_count (PyTypeObject * );
543+ PyAPI_FUNC (void ) inc_count (PyTypeObject * );
544544#define _Py_INC_TPALLOCS (OP ) inc_count((OP)->ob_type)
545545#define _Py_INC_TPFREES (OP ) (OP)->ob_type->tp_frees++
546546#define _Py_DEC_TPFREES (OP ) (OP)->ob_type->tp_frees--
@@ -554,11 +554,11 @@ extern DL_IMPORT(void) inc_count(PyTypeObject *);
554554
555555#ifdef Py_TRACE_REFS
556556/* Py_TRACE_REFS is such major surgery that we call external routines. */
557- extern DL_IMPORT (void ) _Py_NewReference (PyObject * );
558- extern DL_IMPORT (void ) _Py_ForgetReference (PyObject * );
559- extern DL_IMPORT (void ) _Py_Dealloc (PyObject * );
560- extern DL_IMPORT (void ) _Py_PrintReferences (FILE * );
561- extern DL_IMPORT (void ) _Py_ResetReferences (void );
557+ PyAPI_FUNC (void ) _Py_NewReference (PyObject * );
558+ PyAPI_FUNC (void ) _Py_ForgetReference (PyObject * );
559+ PyAPI_FUNC (void ) _Py_Dealloc (PyObject * );
560+ PyAPI_FUNC (void ) _Py_PrintReferences (FILE * );
561+ PyAPI_FUNC (void ) _Py_ResetReferences (void );
562562
563563#else
564564/* Without Py_TRACE_REFS, there's little enough to do that we expand code
@@ -597,14 +597,14 @@ where NULL (nil) is not suitable (since NULL often means 'error').
597597
598598Don't forget to apply Py_INCREF() when returning this value!!!
599599*/
600- extern DL_IMPORT (PyObject ) _Py_NoneStruct ; /* Don't use this directly */
600+ PyAPI_DATA (PyObject ) _Py_NoneStruct ; /* Don't use this directly */
601601#define Py_None (&_Py_NoneStruct)
602602
603603/*
604604Py_NotImplemented is a singleton used to signal that an operation is
605605not implemented for a given type combination.
606606*/
607- extern DL_IMPORT (PyObject ) _Py_NotImplementedStruct ; /* Don't use this directly */
607+ PyAPI_DATA (PyObject ) _Py_NotImplementedStruct ; /* Don't use this directly */
608608#define Py_NotImplemented (&_Py_NotImplementedStruct)
609609
610610/* Rich comparison opcodes */
@@ -720,10 +720,10 @@ chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces,
720720with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL.
721721*/
722722
723- extern DL_IMPORT (void ) _PyTrash_deposit_object (PyObject * );
724- extern DL_IMPORT (void ) _PyTrash_destroy_chain (void );
725- extern DL_IMPORT (int ) _PyTrash_delete_nesting ;
726- extern DL_IMPORT (PyObject * ) _PyTrash_delete_later ;
723+ PyAPI_FUNC (void ) _PyTrash_deposit_object (PyObject * );
724+ PyAPI_FUNC (void ) _PyTrash_destroy_chain (void );
725+ PyAPI_DATA (int ) _PyTrash_delete_nesting ;
726+ PyAPI_DATA (PyObject * ) _PyTrash_delete_later ;
727727
728728#define PyTrash_UNWIND_LEVEL 50
729729
0 commit comments