diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2002-08-12 07:21:58 +0000 |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2002-08-12 07:21:58 +0000 |
commit | 91a681debf9ffec155d0aff8a0bb5f965f592e16 (patch) | |
tree | 09f28782e3b0a24e64deddeafc9df24ac93855ca | |
parent | x_mul(): This failed to normalize its result. (diff) | |
download | cpython-91a681debf9ffec155d0aff8a0bb5f965f592e16.tar.gz cpython-91a681debf9ffec155d0aff8a0bb5f965f592e16.tar.bz2 cpython-91a681debf9ffec155d0aff8a0bb5f965f592e16.zip |
Excise DL_EXPORT from Include.
Thanks to Skip Montanaro and Kalle Svensson for the patches.
51 files changed, 669 insertions, 673 deletions
diff --git a/Include/Python.h b/Include/Python.h index dc9ce457e93..26d221160b4 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -114,7 +114,7 @@ #include "abstract.h" /* _Py_Mangle is defined in compile.c */ -extern DL_IMPORT(int) _Py_Mangle(char *p, char *name, \ +PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \ char *buffer, size_t maxlen); /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ diff --git a/Include/abstract.h b/Include/abstract.h index 459bd566d76..237e950c43e 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -223,7 +223,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) - DL_IMPORT(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); + PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); /* Compare the values of o1 and o2 using a routine provided by @@ -283,7 +283,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PyCallable_Check(PyObject *o); + PyAPI_FUNC(int) PyCallable_Check(PyObject *o); /* Determine if the object, o, is callable. Return 1 if the @@ -295,7 +295,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ - DL_IMPORT(PyObject *) PyObject_Call(PyObject *callable_object, + PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw); /* @@ -305,7 +305,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyObject_CallObject(PyObject *callable_object, + PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, PyObject *args); /* @@ -317,7 +317,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyObject_CallFunction(PyObject *callable_object, + PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object, char *format, ...); /* @@ -331,7 +331,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyObject_CallMethod(PyObject *o, char *m, + PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m, char *format, ...); /* @@ -344,7 +344,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, + PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, ...); /* @@ -357,7 +357,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, + PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, PyObject *m, ...); /* @@ -404,7 +404,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyObject_Type(PyObject *o); + PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); /* On success, returns a type object corresponding to the object @@ -412,7 +412,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ equivalent to the Python expression: type(o). */ - DL_IMPORT(int) PyObject_Size(PyObject *o); + PyAPI_FUNC(int) PyObject_Size(PyObject *o); /* Return the size of object o. If the object, o, provides @@ -424,11 +424,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* For DLL compatibility */ #undef PyObject_Length - DL_IMPORT(int) PyObject_Length(PyObject *o); + PyAPI_FUNC(int) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size - DL_IMPORT(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); + PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); /* Return element of o corresponding to the object, key, or NULL @@ -437,7 +437,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); + PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); /* Map the object, key, to the value, v. Returns @@ -445,7 +445,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ statement: o[key]=v. */ - DL_IMPORT(int) PyObject_DelItemString(PyObject *o, char *key); + PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key); /* Remove the mapping for object, key, from the object *o. @@ -453,14 +453,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ the Python statement: del o[key]. */ - DL_IMPORT(int) PyObject_DelItem(PyObject *o, PyObject *key); + PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); /* Delete the mapping for key from *o. Returns -1 on failure. This is the equivalent of the Python statement: del o[key]. */ - DL_IMPORT(int) PyObject_AsCharBuffer(PyObject *obj, + PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, const char **buffer, int *buffer_len); @@ -476,7 +476,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PyObject_CheckReadBuffer(PyObject *obj); + PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); /* Checks whether an arbitrary object supports the (character, @@ -485,7 +485,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PyObject_AsReadBuffer(PyObject *obj, + PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, const void **buffer, int *buffer_len); @@ -501,7 +501,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PyObject_AsWriteBuffer(PyObject *obj, + PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, void **buffer, int *buffer_len); @@ -518,7 +518,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* Iterators */ - DL_IMPORT(PyObject *) PyObject_GetIter(PyObject *); + PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); /* Takes an object and returns an iterator for it. This is typically a new iterator but if the argument is an iterator, this returns itself. */ @@ -527,7 +527,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \ (obj)->ob_type->tp_iternext != NULL) - DL_IMPORT(PyObject *) PyIter_Next(PyObject *); + PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); /* Takes an iterator object and calls its tp_iternext slot, returning the next value. If the iterator is exhausted, this returns NULL without setting an exception. @@ -535,7 +535,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* Number Protocol:*/ - DL_IMPORT(int) PyNumber_Check(PyObject *o); + PyAPI_FUNC(int) PyNumber_Check(PyObject *o); /* Returns 1 if the object, o, provides numeric protocols, and @@ -545,7 +545,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); /* Returns the result of adding o1 and o2, or null on failure. @@ -554,7 +554,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); /* Returns the result of subtracting o2 from o1, or null on @@ -563,7 +563,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); /* Returns the result of multiplying o1 and o2, or null on @@ -573,7 +573,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2, or null on failure. @@ -582,7 +582,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving an integral result, @@ -592,7 +592,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving a float result, @@ -602,7 +602,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); /* Returns the remainder of dividing o1 by o2, or null on @@ -612,7 +612,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); /* See the built-in function divmod. Returns NULL on failure. @@ -622,7 +622,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, + PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3); /* @@ -632,7 +632,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Negative(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); /* Returns the negation of o on success, or null on failure. @@ -640,7 +640,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Positive(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); /* Returns the (what?) of o on success, or NULL on failure. @@ -648,7 +648,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Absolute(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); /* Returns the absolute value of o, or null on failure. This is @@ -656,7 +656,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Invert(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); /* Returns the bitwise negation of o on success, or NULL on @@ -666,7 +666,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); /* Returns the result of left shifting o1 by o2 on success, or @@ -676,7 +676,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); /* Returns the result of right shifting o1 by o2 on success, or @@ -685,7 +685,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); /* Returns the result of bitwise and of o1 and o2 on success, or @@ -695,7 +695,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); /* Returns the bitwise exclusive or of o1 by o2 on success, or @@ -705,7 +705,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); /* Returns the result of bitwise or or o1 and o2 on success, or @@ -733,7 +733,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Int(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o); /* Returns the o converted to an integer object on success, or @@ -742,7 +742,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Long(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); /* Returns the o converted to a long integer object on success, @@ -751,7 +751,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_Float(PyObject *o); + PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); /* Returns the o converted to a float object on success, or NULL @@ -761,7 +761,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* In-place variants of (some of) the above number protocol functions */ - DL_IMPORT(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); /* Returns the result of adding o2 to o1, possibly in-place, or null @@ -770,7 +770,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); /* Returns the result of subtracting o2 from o1, possibly in-place or @@ -779,7 +779,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); /* Returns the result of multiplying o1 by o2, possibly in-place, or @@ -788,7 +788,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2, possibly in-place, or null @@ -797,7 +797,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, + PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2); /* @@ -808,7 +808,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, + PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2); /* @@ -819,7 +819,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); /* Returns the remainder of dividing o1 by o2, possibly in-place, or @@ -828,7 +828,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, + PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3); /* @@ -838,7 +838,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); /* Returns the result of left shifting o1 by o2, possibly in-place, or @@ -847,7 +847,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); /* Returns the result of right shifting o1 by o2, possibly in-place or @@ -856,7 +856,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); /* Returns the result of bitwise and of o1 and o2, possibly in-place, @@ -865,7 +865,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); /* Returns the bitwise exclusive or of o1 by o2, possibly in-place, or @@ -874,7 +874,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); /* Returns the result of bitwise or or o1 and o2, possibly in-place, @@ -886,7 +886,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* Sequence protocol:*/ - DL_IMPORT(int) PySequence_Check(PyObject *o); + PyAPI_FUNC(int) PySequence_Check(PyObject *o); /* Return 1 if the object provides sequence protocol, and zero @@ -896,7 +896,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PySequence_Size(PyObject *o); + PyAPI_FUNC(int) PySequence_Size(PyObject *o); /* Return the size of sequence object o, or -1 on failure. @@ -905,11 +905,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* For DLL compatibility */ #undef PySequence_Length - DL_IMPORT(int) PySequence_Length(PyObject *o); + PyAPI_FUNC(int) PySequence_Length(PyObject *o); #define PySequence_Length PySequence_Size - DL_IMPORT(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); /* Return the concatenation of o1 and o2 on success, and NULL on @@ -918,7 +918,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PySequence_Repeat(PyObject *o, int count); + PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, int count); /* Return the result of repeating sequence object o count times, @@ -927,14 +927,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PySequence_GetItem(PyObject *o, int i); + PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, int i); /* Return the ith element of o, or NULL on failure. This is the equivalent of the Python expression: o[i]. */ - DL_IMPORT(PyObject *) PySequence_GetSlice(PyObject *o, int i1, int i2); + PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, int i1, int i2); /* Return the slice of sequence object o between i1 and i2, or @@ -943,7 +943,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PySequence_SetItem(PyObject *o, int i, PyObject *v); + PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, int i, PyObject *v); /* Assign object v to the ith element of o. Returns @@ -952,7 +952,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(int) PySequence_DelItem(PyObject *o, int i); + PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, int i); /* Delete the ith element of object v. Returns @@ -960,7 +960,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ statement: del o[i]. */ - DL_IMPORT(int) PySequence_SetSlice(PyObject *o, int i1, int i2, + PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, int i1, int i2, PyObject *v); /* @@ -969,7 +969,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ equivalent of the Python statement: o[i1:i2]=v. */ - DL_IMPORT(int) PySequence_DelSlice(PyObject *o, int i1, int i2); + PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, int i1, int i2); /* Delete the slice in sequence object, o, from i1 to i2. @@ -977,7 +977,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ statement: del o[i1:i2]. */ - DL_IMPORT(PyObject *) PySequence_Tuple(PyObject *o); + PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); /* Returns the sequence, o, as a tuple on success, and NULL on failure. @@ -985,13 +985,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PySequence_List(PyObject *o); + PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); /* Returns the sequence, o, as a list on success, and NULL on failure. This is equivalent to the Python expression: list(o) */ - DL_IMPORT(PyObject *) PySequence_Fast(PyObject *o, const char* m); + PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); /* Returns the sequence, o, as a tuple, unless it's already a tuple or list. Use PySequence_Fast_GET_ITEM to access the @@ -1021,7 +1021,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ need to be corrected for a negative index */ - DL_IMPORT(int) PySequence_Count(PyObject *o, PyObject *value); + PyAPI_FUNC(int) PySequence_Count(PyObject *o, PyObject *value); /* Return the number of occurrences on value on o, that is, @@ -1030,7 +1030,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ expression: o.count(value). */ - DL_IMPORT(int) PySequence_Contains(PyObject *seq, PyObject *ob); + PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); /* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. Use __contains__ if possible, else _PySequence_IterSearch(). @@ -1039,7 +1039,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ #define PY_ITERSEARCH_COUNT 1 #define PY_ITERSEARCH_INDEX 2 #define PY_ITERSEARCH_CONTAINS 3 - DL_IMPORT(int) _PySequence_IterSearch(PyObject *seq, PyObject *obj, + PyAPI_FUNC(int) _PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation); /* Iterate over seq. Result depends on the operation: @@ -1054,7 +1054,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* For DLL-level backwards compatibility */ #undef PySequence_In - DL_IMPORT(int) PySequence_In(PyObject *o, PyObject *value); + PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); /* For source-level backwards compatibility */ #define PySequence_In PySequence_Contains @@ -1065,7 +1065,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ is equivalent to the Python expression: value in o. */ - DL_IMPORT(int) PySequence_Index(PyObject *o, PyObject *value); + PyAPI_FUNC(int) PySequence_Index(PyObject *o, PyObject *value); /* Return the first index for which o[i]=value. On error, @@ -1075,7 +1075,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* In-place versions of some of the above Sequence functions. */ - DL_IMPORT(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); + PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); /* Append o2 to o1, in-place when possible. Return the resulting @@ -1084,7 +1084,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ - DL_IMPORT(PyObject *) PySequence_InPlaceRepeat(PyObject *o, int count); + PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, int count); /* Repeat o1 by count, in-place when possible. Return the resulting @@ -1095,7 +1095,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* Mapping protocol:*/ - DL_IMPORT(int) PyMapping_Check(PyObject *o); + PyAPI_FUNC(int) PyMapping_Check(PyObject *o); /* Return 1 if the object provides mapping protocol, and zero @@ -1104,7 +1104,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ This function always succeeds. */ - DL_IMPORT(int) PyMapping_Size(PyObject *o); + PyAPI_FUNC(int) PyMapping_Size(PyObject *o); /* Returns the number of keys in object o on success, and -1 on @@ -1114,7 +1114,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* For DLL compatibility */ #undef PyMapping_Length - DL_IMPORT(int) PyMapping_Length(PyObject *o); + PyAPI_FUNC(int) PyMapping_Length(PyObject *o); #define PyMapping_Length PyMapping_Size @@ -1138,7 +1138,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) - DL_IMPORT(int) PyMapping_HasKeyString(PyObject *o, char *key); + PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key); /* On success, return 1 if the mapping object has the key, key, @@ -1148,7 +1148,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ This function always succeeds. */ - DL_IMPORT(int) PyMapping_HasKey(PyObject *o, PyObject *key); + PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); /* Return 1 if the mapping object has the key, key, @@ -1191,7 +1191,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ #define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL) - DL_IMPORT(PyObject *) PyMapping_GetItemString(PyObject *o, char *key); + PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key); /* Return element of o corresponding to the object, key, or NULL @@ -1199,7 +1199,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ o[key]. */ - DL_IMPORT(int) PyMapping_SetItemString(PyObject *o, char *key, + PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key, PyObject *value); /* @@ -1209,10 +1209,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ */ -DL_IMPORT(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); +PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); /* isinstance(object, typeorclass) */ -DL_IMPORT(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); +PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); /* issubclass(object, typeorclass) */ diff --git a/Include/boolobject.h b/Include/boolobject.h index 02591265c09..e7a4e607960 100644 --- a/Include/boolobject.h +++ b/Include/boolobject.h @@ -9,7 +9,7 @@ extern "C" { typedef PyIntObject PyBoolObject; -extern DL_IMPORT(PyTypeObject) PyBool_Type; +PyAPI_DATA(PyTypeObject) PyBool_Type; #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type) @@ -17,14 +17,14 @@ extern DL_IMPORT(PyTypeObject) PyBool_Type; Don't forget to apply Py_INCREF() when returning either!!! */ /* Don't use these directly */ -extern DL_IMPORT(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; +PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; /* Use these macros */ #define Py_False ((PyObject *) &_Py_ZeroStruct) #define Py_True ((PyObject *) &_Py_TrueStruct) /* Function to return a bool from a C long */ -extern DL_IMPORT(PyObject *) PyBool_FromLong(long); +PyAPI_FUNC(PyObject *) PyBool_FromLong(long); #ifdef __cplusplus } diff --git a/Include/bufferobject.h b/Include/bufferobject.h index e4109aeb134..ed2c91db5f6 100644 --- a/Include/bufferobject.h +++ b/Include/bufferobject.h @@ -10,22 +10,22 @@ extern "C" { #endif -extern DL_IMPORT(PyTypeObject) PyBuffer_Type; +PyAPI_DATA(PyTypeObject) PyBuffer_Type; #define PyBuffer_Check(op) ((op)->ob_type == &PyBuffer_Type) #define Py_END_OF_BUFFER (-1) -extern DL_IMPORT(PyObject *) PyBuffer_FromObject(PyObject *base, +PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base, int offset, int size); -extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, +PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, int offset, int size); -extern DL_IMPORT(PyObject *) PyBuffer_FromMemory(void *ptr, int size); -extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, int size); +PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, int size); +PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, int size); -extern DL_IMPORT(PyObject *) PyBuffer_New(int size); +PyAPI_FUNC(PyObject *) PyBuffer_New(int size); #ifdef __cplusplus } diff --git a/Include/cellobject.h b/Include/cellobject.h index f3eef55e494..2a6dcaa483a 100644 --- a/Include/cellobject.h +++ b/Include/cellobject.h @@ -11,13 +11,13 @@ typedef struct { PyObject *ob_ref; } PyCellObject; -extern DL_IMPORT(PyTypeObject) PyCell_Type; +PyAPI_DATA(PyTypeObject) PyCell_Type; #define PyCell_Check(op) ((op)->ob_type == &PyCell_Type) -extern DL_IMPORT(PyObject *) PyCell_New(PyObject *); -extern DL_IMPORT(PyObject *) PyCell_Get(PyObject *); -extern DL_IMPORT(int) PyCell_Set(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); +PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); +PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) diff --git a/Include/ceval.h b/Include/ceval.h index ae4d8583c6c..63204b267e9 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -7,46 +7,46 @@ extern "C" { /* Interface to random parts in ceval.c */ -DL_IMPORT(PyObject *) PyEval_CallObjectWithKeywords - (PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( + PyObject *, PyObject *, PyObject *); /* DLL-level Backwards compatibility: */ #undef PyEval_CallObject -DL_IMPORT(PyObject *) PyEval_CallObject(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *); /* Inline this */ #define PyEval_CallObject(func,arg) \ PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) -DL_IMPORT(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...); -DL_IMPORT(PyObject *) PyEval_CallMethod(PyObject *obj, +PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...); +PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...); -DL_IMPORT(void) PyEval_SetProfile(Py_tracefunc, PyObject *); -DL_IMPORT(void) PyEval_SetTrace(Py_tracefunc, PyObject *); +PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); +PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); -DL_IMPORT(PyObject *) PyEval_GetBuiltins(void); -DL_IMPORT(PyObject *) PyEval_GetGlobals(void); -DL_IMPORT(PyObject *) PyEval_GetLocals(void); -DL_IMPORT(PyObject *) PyEval_GetOwner(void); -DL_IMPORT(PyObject *) PyEval_GetFrame(void); -DL_IMPORT(int) PyEval_GetRestricted(void); +PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); +PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); +PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); +PyAPI_FUNC(PyObject *) PyEval_GetOwner(void); +PyAPI_FUNC(PyObject *) PyEval_GetFrame(void); +PyAPI_FUNC(int) PyEval_GetRestricted(void); /* Look at the current frame's (if any) code's co_flags, and turn on the corresponding compiler flags in cf->cf_flags. Return 1 if any flag was set, else return 0. */ -DL_IMPORT(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); +PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); -DL_IMPORT(int) Py_FlushLine(void); +PyAPI_FUNC(int) Py_FlushLine(void); -DL_IMPORT(int) Py_AddPendingCall(int (*func)(void *), void *arg); -DL_IMPORT(int) Py_MakePendingCalls(void); +PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); +PyAPI_FUNC(int) Py_MakePendingCalls(void); -DL_IMPORT(void) Py_SetRecursionLimit(int); -DL_IMPORT(int) Py_GetRecursionLimit(void); +PyAPI_FUNC(void) Py_SetRecursionLimit(int); +PyAPI_FUNC(int) Py_GetRecursionLimit(void); -DL_IMPORT(char *) PyEval_GetFuncName(PyObject *); -DL_IMPORT(char *) PyEval_GetFuncDesc(PyObject *); +PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *); +PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *); /* Interface for threads. @@ -93,17 +93,17 @@ DL_IMPORT(char *) PyEval_GetFuncDesc(PyObject *); mechanism! */ -extern DL_IMPORT(PyThreadState *) PyEval_SaveThread(void); -extern DL_IMPORT(void) PyEval_RestoreThread(PyThreadState *); +PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); +PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); #ifdef WITH_THREAD -extern DL_IMPORT(void) PyEval_InitThreads(void); -extern DL_IMPORT(void) PyEval_AcquireLock(void); -extern DL_IMPORT(void) PyEval_ReleaseLock(void); -extern DL_IMPORT(void) PyEval_AcquireThread(PyThreadState *tstate); -extern DL_IMPORT(void) PyEval_ReleaseThread(PyThreadState *tstate); -extern DL_IMPORT(void) PyEval_ReInitThreads(void); +PyAPI_FUNC(void) PyEval_InitThreads(void); +PyAPI_FUNC(void) PyEval_AcquireLock(void); +PyAPI_FUNC(void) PyEval_ReleaseLock(void); +PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); +PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); +PyAPI_FUNC(void) PyEval_ReInitThreads(void); #define Py_BEGIN_ALLOW_THREADS { \ PyThreadState *_save; \ @@ -122,7 +122,7 @@ extern DL_IMPORT(void) PyEval_ReInitThreads(void); #endif /* !WITH_THREAD */ -extern DL_IMPORT(int) _PyEval_SliceIndex(PyObject *, int *); +PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, int *); #ifdef __cplusplus diff --git a/Include/classobject.h b/Include/classobject.h index c79f4a22ec3..b071e98f04e 100644 --- a/Include/classobject.h +++ b/Include/classobject.h @@ -35,21 +35,21 @@ typedef struct { PyObject *im_weakreflist; /* List of weak references */ } PyMethodObject; -extern DL_IMPORT(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; +PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) -extern DL_IMPORT(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyInstance_New(PyObject *, PyObject *, +PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *); -extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *); -extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ @@ -60,7 +60,7 @@ extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *); #define PyMethod_GET_CLASS(meth) \ (((PyMethodObject *)meth) -> im_class) -extern DL_IMPORT(int) PyClass_IsSubclass(PyObject *, PyObject *); +PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); #ifdef __cplusplus diff --git a/Include/cobject.h b/Include/cobject.h index f710d4af772..ccf8b32c355 100644 --- a/Include/cobject.h +++ b/Include/cobject.h @@ -14,7 +14,7 @@ extern "C" { #endif -extern DL_IMPORT(PyTypeObject) PyCObject_Type; +PyAPI_DATA(PyTypeObject) PyCObject_Type; #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type) @@ -24,8 +24,8 @@ extern DL_IMPORT(PyTypeObject) PyCObject_Type; destroyed. */ -extern DL_IMPORT(PyObject *) -PyCObject_FromVoidPtr(void *cobj, void (*destruct)(void*)); +PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr( + void *cobj, void (*destruct)(void*)); /* Create a PyCObject from a pointer to a C object, a description object, @@ -33,21 +33,17 @@ PyCObject_FromVoidPtr(void *cobj, void (*destruct)(void*)); then it will be called with the first and second arguments if and when the PyCObject is destroyed. */ -extern DL_IMPORT(PyObject *) -PyCObject_FromVoidPtrAndDesc(void *cobj, void *desc, - void (*destruct)(void*,void*)); +PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc( + void *cobj, void *desc, void (*destruct)(void*,void*)); /* Retrieve a pointer to a C object from a PyCObject. */ -extern DL_IMPORT(void *) -PyCObject_AsVoidPtr(PyObject *); +PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *); /* Retrieve a pointer to a description object from a PyCObject. */ -extern DL_IMPORT(void *) -PyCObject_GetDesc(PyObject *); +PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *); /* Import a pointer to a C object from a module using a PyCObject. */ -extern DL_IMPORT(void *) -PyCObject_Import(char *module_name, char *cobject_name); +PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name); #ifdef __cplusplus } diff --git a/Include/codecs.h b/Include/codecs.h index eee74a78ffa..2cc4d7d350a 100644 --- a/Include/codecs.h +++ b/Include/codecs.h @@ -23,7 +23,7 @@ Copyright (c) Corporation for National Research Initiatives. The search_function's refcount is incremented by this function. */ -extern DL_IMPORT(int) PyCodec_Register( +PyAPI_FUNC(int) PyCodec_Register( PyObject *search_function ); @@ -45,7 +45,7 @@ extern DL_IMPORT(int) PyCodec_Register( */ -extern DL_IMPORT(PyObject *) _PyCodec_Lookup( +PyAPI_FUNC(PyObject *) _PyCodec_Lookup( const char *encoding ); @@ -59,7 +59,7 @@ extern DL_IMPORT(PyObject *) _PyCodec_Lookup( */ -extern DL_IMPORT(PyObject *) PyCodec_Encode( +PyAPI_FUNC(PyObject *) PyCodec_Encode( PyObject *object, const char *encoding, const char *errors @@ -75,7 +75,7 @@ extern DL_IMPORT(PyObject *) PyCodec_Encode( */ -extern DL_IMPORT(PyObject *) PyCodec_Decode( +PyAPI_FUNC(PyObject *) PyCodec_Decode( PyObject *object, const char *encoding, const char *errors @@ -91,19 +91,19 @@ extern DL_IMPORT(PyObject *) PyCodec_Decode( /* Get an encoder function for the given encoding. */ -extern DL_IMPORT(PyObject *) PyCodec_Encoder( +PyAPI_FUNC(PyObject *) PyCodec_Encoder( const char *encoding ); /* Get a decoder function for the given encoding. */ -extern DL_IMPORT(PyObject *) PyCodec_Decoder( +PyAPI_FUNC(PyObject *) PyCodec_Decoder( const char *encoding ); /* Get a StreamReader factory function for the given encoding. */ -extern DL_IMPORT(PyObject *) PyCodec_StreamReader( +PyAPI_FUNC(PyObject *) PyCodec_StreamReader( const char *encoding, PyObject *stream, const char *errors @@ -111,7 +111,7 @@ extern DL_IMPORT(PyObject *) PyCodec_StreamReader( /* Get a StreamWriter factory function for the given encoding. */ -extern DL_IMPORT(PyObject *) PyCodec_StreamWriter( +PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( const char *encoding, PyObject *stream, const char *errors diff --git a/Include/compile.h b/Include/compile.h index 39c00f26805..a4b2f55f80d 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -43,7 +43,7 @@ typedef struct { #define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */ #define CO_FUTURE_DIVISION 0x2000 -extern DL_IMPORT(PyTypeObject) PyCode_Type; +PyAPI_DATA(PyTypeObject) PyCode_Type; #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) @@ -52,12 +52,12 @@ extern DL_IMPORT(PyTypeObject) PyCode_Type; /* Public interface */ struct _node; /* Declare the existence of this type */ -DL_IMPORT(PyCodeObject *) PyNode_Compile(struct _node *, char *); -DL_IMPORT(PyCodeObject *) PyCode_New( +PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, char *); +PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ -DL_IMPORT(int) PyCode_Addr2Line(PyCodeObject *, int); +PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* Future feature support */ @@ -67,8 +67,8 @@ typedef struct { int ff_features; } PyFutureFeatures; -DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *); -DL_IMPORT(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, +PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, char *); +PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, PyCompilerFlags *); #define FUTURE_NESTED_SCOPES "nested_scopes" diff --git a/Include/complexobject.h b/Include/complexobject.h index b82eb90dcf5..f5b755d60a2 100644 --- a/Include/complexobject.h +++ b/Include/complexobject.h @@ -20,12 +20,12 @@ typedef struct { #define c_quot _Py_c_quot #define c_pow _Py_c_pow -extern DL_IMPORT(Py_complex) c_sum(Py_complex, Py_complex); -extern DL_IMPORT(Py_complex) c_diff(Py_complex, Py_complex); -extern DL_IMPORT(Py_complex) c_neg(Py_complex); -extern DL_IMPORT(Py_complex) c_prod(Py_complex, Py_complex); -extern DL_IMPORT(Py_complex) c_quot(Py_complex, Py_complex); -extern DL_IMPORT(Py_complex) c_pow(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_neg(Py_complex); +PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); /* Complex object interface */ @@ -40,17 +40,17 @@ typedef struct { Py_complex cval; } PyComplexObject; -extern DL_IMPORT(PyTypeObject) PyComplex_Type; +PyAPI_DATA(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) #define PyComplex_CheckExact(op) ((op)->ob_type == &PyComplex_Type) -extern DL_IMPORT(PyObject *) PyComplex_FromCComplex(Py_complex); -extern DL_IMPORT(PyObject *) PyComplex_FromDoubles(double real, double imag); +PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); +PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); -extern DL_IMPORT(double) PyComplex_RealAsDouble(PyObject *op); -extern DL_IMPORT(double) PyComplex_ImagAsDouble(PyObject *op); -extern DL_IMPORT(Py_complex) PyComplex_AsCComplex(PyObject *op); +PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); +PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); +PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); #ifdef __cplusplus } diff --git a/Include/descrobject.h b/Include/descrobject.h index 6482e56a4db..13190365b55 100644 --- a/Include/descrobject.h +++ b/Include/descrobject.h @@ -67,22 +67,22 @@ typedef struct { void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; -extern DL_IMPORT(PyTypeObject) PyWrapperDescr_Type; +PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; -extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); -extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *, +PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); +PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, struct PyMemberDef *); -extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *, +PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); -extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *, +PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); -extern DL_IMPORT(int) PyDescr_IsData(PyObject *); +PyAPI_FUNC(int) PyDescr_IsData(PyObject *); -extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *); -extern DL_IMPORT(PyObject *) PyWrapper_New(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); +PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); -extern DL_IMPORT(PyTypeObject) PyProperty_Type; +PyAPI_DATA(PyTypeObject) PyProperty_Type; #ifdef __cplusplus } #endif diff --git a/Include/dictobject.h b/Include/dictobject.h index 27ef90d3b41..36053e83ee6 100644 --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -78,32 +78,32 @@ struct _dictobject { PyDictEntry ma_smalltable[PyDict_MINSIZE]; }; -extern DL_IMPORT(PyTypeObject) PyDict_Type; +PyAPI_DATA(PyTypeObject) PyDict_Type; #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) -extern DL_IMPORT(PyObject *) PyDict_New(void); -extern DL_IMPORT(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); -extern DL_IMPORT(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); -extern DL_IMPORT(int) PyDict_DelItem(PyObject *mp, PyObject *key); -extern DL_IMPORT(void) PyDict_Clear(PyObject *mp); -extern DL_IMPORT(int) PyDict_Next - (PyObject *mp, int *pos, PyObject **key, PyObject **value); -extern DL_IMPORT(PyObject *) PyDict_Keys(PyObject *mp); -extern DL_IMPORT(PyObject *) PyDict_Values(PyObject *mp); -extern DL_IMPORT(PyObject *) PyDict_Items(PyObject *mp); -extern DL_IMPORT(int) PyDict_Size(PyObject *mp); -extern DL_IMPORT(PyObject *) PyDict_Copy(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_New(void); +PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); +PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); +PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); +PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); +PyAPI_FUNC(int) PyDict_Next( + PyObject *mp, int *pos, PyObject **key, PyObject **value); +PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); +PyAPI_FUNC(int) PyDict_Size(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ -extern DL_IMPORT(int) PyDict_Update(PyObject *mp, PyObject *other); +PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); /* PyDict_Merge updates/merges from a mapping object (an object that supports PyMapping_Keys() and PyObject_GetItem()). If override is true, the last occurrence of a key wins, else the first. The Python dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). */ -extern DL_IMPORT(int) PyDict_Merge(PyObject *mp, +PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, PyObject *other, int override); @@ -112,13 +112,13 @@ extern DL_IMPORT(int) PyDict_Merge(PyObject *mp, of a key wins, else the first. The Python dict constructor dict(seq2) is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). */ -extern DL_IMPORT(int) PyDict_MergeFromSeq2(PyObject *d, +PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override); -extern DL_IMPORT(PyObject *) PyDict_GetItemString(PyObject *dp, char *key); -extern DL_IMPORT(int) PyDict_SetItemString(PyObject *dp, char *key, PyObject *item); -extern DL_IMPORT(int) PyDict_DelItemString(PyObject *dp, char *key); +PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, char *key); +PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, char *key, PyObject *item); +PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, char *key); #ifdef __cplusplus } diff --git a/Include/enumobject.h b/Include/enumobject.h index df20fb0b2c6..053fb72a5ec 100644 --- a/Include/enumobject.h +++ b/Include/enumobject.h @@ -7,7 +7,7 @@ extern "C" { #endif -extern DL_IMPORT(PyTypeObject) PyEnum_Type; +PyAPI_DATA(PyTypeObject) PyEnum_Type; #ifdef __cplusplus } diff --git a/Include/eval.h b/Include/eval.h index f9334a75f07..66638e75d13 100644 --- a/Include/eval.h +++ b/Include/eval.h @@ -7,9 +7,9 @@ extern "C" { #endif -DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); -DL_IMPORT(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, +PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argc, diff --git a/Include/fileobject.h b/Include/fileobject.h index fd04d3574b0..c351b4d09d3 100644 --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -26,27 +26,27 @@ typedef struct { #endif } PyFileObject; -extern DL_IMPORT(PyTypeObject) PyFile_Type; +PyAPI_DATA(PyTypeObject) PyFile_Type; #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) #define PyFile_CheckExact(op) ((op)->ob_type == &PyFile_Type) -extern DL_IMPORT(PyObject *) PyFile_FromString(char *, char *); -extern DL_IMPORT(void) PyFile_SetBufSize(PyObject *, int); -extern DL_IMPORT(PyObject *) PyFile_FromFile(FILE *, char *, char *, +PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); +PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); +PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); -extern DL_IMPORT(FILE *) PyFile_AsFile(PyObject *); -extern DL_IMPORT(PyObject *) PyFile_Name(PyObject *); -extern DL_IMPORT(PyObject *) PyFile_GetLine(PyObject *, int); -extern DL_IMPORT(int) PyFile_WriteObject(PyObject *, PyObject *, int); -extern DL_IMPORT(int) PyFile_SoftSpace(PyObject *, int); -extern DL_IMPORT(int) PyFile_WriteString(const char *, PyObject *); -extern DL_IMPORT(int) PyObject_AsFileDescriptor(PyObject *); +PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); +PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *); +PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); +PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); +PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int); +PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); +PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); /* The default encoding used by the platform file system APIs If non-NULL, this is different than the default encoding for strings */ -extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding; +PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; #ifdef WITH_UNIVERSAL_NEWLINES /* Routines to replace fread() and fgets() which accept any of \r, \n diff --git a/Include/floatobject.h b/Include/floatobject.h index bd4a782846d..8b151cd1610 100644 --- a/Include/floatobject.h +++ b/Include/floatobject.h @@ -16,7 +16,7 @@ typedef struct { double ob_fval; } PyFloatObject; -extern DL_IMPORT(PyTypeObject) PyFloat_Type; +PyAPI_DATA(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) #define PyFloat_CheckExact(op) ((op)->ob_type == &PyFloat_Type) @@ -24,28 +24,28 @@ extern DL_IMPORT(PyTypeObject) PyFloat_Type; /* Return Python float from string PyObject. Second argument ignored on input, and, if non-NULL, NULL is stored into *junk (this tried to serve a purpose once but can't be made to work as intended). */ -extern DL_IMPORT(PyObject *) PyFloat_FromString(PyObject*, char** junk); +PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk); /* Return Python float from C double. */ -extern DL_IMPORT(PyObject *) PyFloat_FromDouble(double); +PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); /* Extract C double from Python float. The macro version trades safety for speed. */ -extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *); +PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) /* Write repr(v) into the char buffer argument, followed by null byte. The buffer must be "big enough"; >= 100 is very safe. PyFloat_AsReprString(buf, x) strives to print enough digits so that PyFloat_FromString(buf) then reproduces x exactly. */ -extern DL_IMPORT(void) PyFloat_AsReprString(char*, PyFloatObject *v); +PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v); /* Write str(v) into the char buffer argument, followed by null byte. The buffer must be "big enough"; >= 100 is very safe. Note that it's unusual to be able to get back the float you started with from PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to preserve precision across conversions. */ -extern DL_IMPORT(void) PyFloat_AsString(char*, PyFloatObject *v); +PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v); #ifdef __cplusplus } diff --git a/Include/frameobject.h b/Include/frameobject.h index 185c28658eb..958b952fa53 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -44,11 +44,11 @@ typedef struct _frame { /* Standard object interface */ -extern DL_IMPORT(PyTypeObject) PyFrame_Type; +PyAPI_DATA(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) -DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, +PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); @@ -56,17 +56,17 @@ DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, /* Block management functions */ -DL_IMPORT(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); -DL_IMPORT(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); +PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); +PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); /* Extend the value stack */ -DL_IMPORT(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); +PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); /* Conversions between "fast locals" and locals in dictionary */ -DL_IMPORT(void) PyFrame_LocalsToFast(PyFrameObject *, int); -DL_IMPORT(void) PyFrame_FastToLocals(PyFrameObject *); +PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); +PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); #ifdef __cplusplus } diff --git a/Include/funcobject.h b/Include/funcobject.h index 6b1e389b7ce..7fee800895c 100644 --- a/Include/funcobject.h +++ b/Include/funcobject.h @@ -19,17 +19,17 @@ typedef struct { PyObject *func_weakreflist; } PyFunctionObject; -extern DL_IMPORT(PyTypeObject) PyFunction_Type; +PyAPI_DATA(PyTypeObject) PyFunction_Type; #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type) -extern DL_IMPORT(PyObject *) PyFunction_New(PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyFunction_GetCode(PyObject *); -extern DL_IMPORT(PyObject *) PyFunction_GetGlobals(PyObject *); -extern DL_IMPORT(PyObject *) PyFunction_GetDefaults(PyObject *); -extern DL_IMPORT(int) PyFunction_SetDefaults(PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyFunction_GetClosure(PyObject *); -extern DL_IMPORT(int) PyFunction_SetClosure(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); +PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); +PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ @@ -43,11 +43,11 @@ extern DL_IMPORT(int) PyFunction_SetClosure(PyObject *, PyObject *); (((PyFunctionObject *)func) -> func_closure) /* The classmethod and staticmethod types lives here, too */ -extern DL_IMPORT(PyTypeObject) PyClassMethod_Type; -extern DL_IMPORT(PyTypeObject) PyStaticMethod_Type; +PyAPI_DATA(PyTypeObject) PyClassMethod_Type; +PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; -extern DL_IMPORT(PyObject *) PyClassMethod_New(PyObject *); -extern DL_IMPORT(PyObject *) PyStaticMethod_New(PyObject *); +PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); +PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); #ifdef __cplusplus } diff --git a/Include/intobject.h b/Include/intobject.h index f48894c9613..ab936b26158 100644 --- a/Include/intobject.h +++ b/Include/intobject.h @@ -25,30 +25,30 @@ typedef struct { long ob_ival; } PyIntObject; -extern DL_IMPORT(PyTypeObject) PyInt_Type; +PyAPI_DATA(PyTypeObject) PyInt_Type; #define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type) #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) -extern DL_IMPORT(PyObject *) PyInt_FromString(char*, char**, int); +PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); #ifdef Py_USING_UNICODE -extern DL_IMPORT(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int); +PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int); #endif -extern DL_IMPORT(PyObject *) PyInt_FromLong(long); -extern DL_IMPORT(long) PyInt_AsLong(PyObject *); -extern DL_IMPORT(long) PyInt_GetMax(void); +PyAPI_FUNC(PyObject *) PyInt_FromLong(long); +PyAPI_FUNC(long) PyInt_AsLong(PyObject *); +PyAPI_FUNC(long) PyInt_GetMax(void); /* Macro, trading safety for speed */ #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) /* These aren't really part of the Int object, but they're handy; the protos - * are necessary for systems that need the magic of DL_IMPORT and that want + * are necessary for systems that need the magic of PyAPI_FUNC and that want * to have stropmodule as a dynamically loaded module instead of building it * into the main Python shared library/DLL. Guido thinks I'm weird for * building it this way. :-) [cjh] */ -extern DL_IMPORT(unsigned long) PyOS_strtoul(char *, char **, int); -extern DL_IMPORT(long) PyOS_strtol(char *, char **, int); +PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); +PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); #ifdef __cplusplus } diff --git a/Include/intrcheck.h b/Include/intrcheck.h index 6ccdc3b3ee7..3b67ed0d5a4 100644 --- a/Include/intrcheck.h +++ b/Include/intrcheck.h @@ -5,9 +5,9 @@ extern "C" { #endif -extern DL_IMPORT(int) PyOS_InterruptOccurred(void); -extern DL_IMPORT(void) PyOS_InitInterrupts(void); -DL_IMPORT(void) PyOS_AfterFork(void); +PyAPI_FUNC(int) PyOS_InterruptOccurred(void); +PyAPI_FUNC(void) PyOS_InitInterrupts(void); +PyAPI_FUNC(void) PyOS_AfterFork(void); #ifdef __cplusplus } diff --git a/Include/iterobject.h b/Include/iterobject.h index 8abe678e4c6..c078ebb28b0 100644 --- a/Include/iterobject.h +++ b/Include/iterobject.h @@ -5,17 +5,17 @@ extern "C" { #endif -extern DL_IMPORT(PyTypeObject) PySeqIter_Type; +PyAPI_DATA(PyTypeObject) PySeqIter_Type; #define PySeqIter_Check(op) ((op)->ob_type == &PySeqIter_Type) -extern DL_IMPORT(PyObject *) PySeqIter_New(PyObject *); +PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); -extern DL_IMPORT(PyTypeObject) PyCallIter_Type; +PyAPI_DATA(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) ((op)->ob_type == &PyCallIter_Type) -extern DL_IMPORT(PyObject *) PyCallIter_New(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); #ifdef __cplusplus } #endif diff --git a/Include/listobject.h b/Include/listobject.h index 1befe86de26..14ed72ef875 100644 --- a/Include/listobject.h +++ b/Include/listobject.h @@ -24,22 +24,22 @@ typedef struct { PyObject **ob_item; } PyListObject; -extern DL_IMPORT(PyTypeObject) PyList_Type; +PyAPI_DATA(PyTypeObject) PyList_Type; #define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type) #define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type) -extern DL_IMPORT(PyObject *) PyList_New(int size); -extern DL_IMPORT(int) PyList_Size(PyObject *); -extern DL_IMPORT(PyObject *) PyList_GetItem(PyObject *, int); -extern DL_IMPORT(int) PyList_SetItem(PyObject *, int, PyObject *); -extern DL_IMPORT(int) PyList_Insert(PyObject *, int, PyObject *); -extern DL_IMPORT(int) PyList_Append(PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) PyList_GetSlice(PyObject *, int, int); -extern DL_IMPORT(int) PyList_SetSlice(PyObject *, int, int, PyObject *); -extern DL_IMPORT(int) PyList_Sort(PyObject *); -extern DL_IMPORT(int) PyList_Reverse(PyObject *); -extern DL_IMPORT(PyObject *) PyList_AsTuple(PyObject *); +PyAPI_FUNC(PyObject *) PyList_New(int size); +PyAPI_FUNC(int) PyList_Size(PyObject *); +PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, int); +PyAPI_FUNC(int) PyList_SetItem(PyObject *, int, PyObject *); +PyAPI_FUNC(int) PyList_Insert(PyObject *, int, PyObject *); +PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, int, int); +PyAPI_FUNC(int) PyList_SetSlice(PyObject *, int, int, PyObject *); +PyAPI_FUNC(int) PyList_Sort(PyObject *); +PyAPI_FUNC(int) PyList_Reverse(PyObject *); +PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); /* Macro, trading safety for speed */ #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) diff --git a/Include/longintrepr.h b/Include/longintrepr.h index abf86406840..5755adb3066 100644 --- a/Include/longintrepr.h +++ b/Include/longintrepr.h @@ -47,10 +47,10 @@ struct _longobject { digit ob_digit[1]; }; -DL_IMPORT(PyLongObject *) _PyLong_New(int); +PyAPI_FUNC(PyLongObject *) _PyLong_New(int); /* Return a copy of src. */ -DL_IMPORT(PyObject *) _PyLong_Copy(PyLongObject *src); +PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); #ifdef __cplusplus } diff --git a/Include/longobject.h b/Include/longobject.h index 4cc94026392..e452f5165fa 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -9,16 +9,16 @@ extern "C" { typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ -extern DL_IMPORT(PyTypeObject) PyLong_Type; +PyAPI_DATA(PyTypeObject) PyLong_Type; #define PyLong_Check(op) PyObject_TypeCheck(op, &PyLong_Type) #define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type) -extern DL_IMPORT(PyObject *) PyLong_FromLong(long); -extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong(unsigned long); -extern DL_IMPORT(PyObject *) PyLong_FromDouble(double); -extern DL_IMPORT(long) PyLong_AsLong(PyObject *); -extern DL_IMPORT(unsigned long) PyLong_AsUnsignedLong(PyObject *); +PyAPI_FUNC(PyObject *) PyLong_FromLong(long); +PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); +PyAPI_FUNC(PyObject *) PyLong_FromDouble(double); +PyAPI_FUNC(long) PyLong_AsLong(PyObject *); +PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); /* _PyLong_AsScaledDouble returns a double x and an exponent e such that the true value is approximately equal to x * 2**(SHIFT*e). e is >= 0. @@ -26,22 +26,22 @@ extern DL_IMPORT(unsigned long) PyLong_AsUnsignedLong(PyObject *); zeroes). Overflow is impossible. Note that the exponent returned must be multiplied by SHIFT! There may not be enough room in an int to store e*SHIFT directly. */ -extern DL_IMPORT(double) _PyLong_AsScaledDouble(PyObject *vv, int *e); +PyAPI_FUNC(double) _PyLong_AsScaledDouble(PyObject *vv, int *e); -extern DL_IMPORT(double) PyLong_AsDouble(PyObject *); -extern DL_IMPORT(PyObject *) PyLong_FromVoidPtr(void *); -extern DL_IMPORT(void *) PyLong_AsVoidPtr(PyObject *); +PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); +PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); +PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); #ifdef HAVE_LONG_LONG -extern DL_IMPORT(PyObject *) PyLong_FromLongLong(LONG_LONG); -extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); -extern DL_IMPORT(LONG_LONG) PyLong_AsLongLong(PyObject *); -extern DL_IMPORT(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); +PyAPI_FUNC(PyObject *) PyLong_FromLongLong(LONG_LONG); +PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); +PyAPI_FUNC(LONG_LONG) PyLong_AsLongLong(PyObject *); +PyAPI_FUNC(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); #endif /* HAVE_LONG_LONG */ -DL_IMPORT(PyObject *) PyLong_FromString(char *, char **, int); +PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); #ifdef Py_USING_UNICODE -DL_IMPORT(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); +PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); #endif /* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in @@ -57,7 +57,7 @@ DL_IMPORT(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); + Return NULL with the appropriate exception set if there's not enough memory to create the Python long. */ -extern DL_IMPORT(PyObject *) _PyLong_FromByteArray( +PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( const unsigned char* bytes, size_t n, int little_endian, int is_signed); @@ -80,7 +80,7 @@ extern DL_IMPORT(PyObject *) _PyLong_FromByteArray( being large enough to hold a sign bit. OverflowError is set in this case, but bytes holds the least-signficant n bytes of the true value. */ -extern DL_IMPORT(int) _PyLong_AsByteArray(PyLongObject* v, +PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed); diff --git a/Include/marshal.h b/Include/marshal.h index 722be741229..cc73f23c1a3 100644 --- a/Include/marshal.h +++ b/Include/marshal.h @@ -7,16 +7,16 @@ extern "C" { #endif -DL_IMPORT(void) PyMarshal_WriteLongToFile(long, FILE *); -DL_IMPORT(void) PyMarshal_WriteShortToFile(int, FILE *); -DL_IMPORT(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *); -DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString(PyObject *); +PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *); +PyAPI_FUNC(void) PyMarshal_WriteShortToFile(int, FILE *); +PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *); -DL_IMPORT(long) PyMarshal_ReadLongFromFile(FILE *); -DL_IMPORT(int) PyMarshal_ReadShortFromFile(FILE *); -DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); -DL_IMPORT(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); -DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString(char *, int); +PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); +PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, int); #ifdef __cplusplus } diff --git a/Include/methodobject.h b/Include/methodobject.h index 21dcdda927a..993bdae2893 100644 --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -7,7 +7,7 @@ extern "C" { #endif -extern DL_IMPORT(PyTypeObject) PyCFunction_Type; +PyAPI_DATA(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type) @@ -16,9 +16,9 @@ typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*PyNoArgsFunction)(PyObject *); -extern DL_IMPORT(PyCFunction) PyCFunction_GetFunction(PyObject *); -extern DL_IMPORT(PyObject *) PyCFunction_GetSelf(PyObject *); -extern DL_IMPORT(int) PyCFunction_GetFlags(PyObject *); +PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); +PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); +PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ @@ -28,7 +28,7 @@ extern DL_IMPORT(int) PyCFunction_GetFlags(PyObject *); (((PyCFunctionObject *)func) -> m_self) #define PyCFunction_GET_FLAGS(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags) -extern DL_IMPORT(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); struct PyMethodDef { char *ml_name; @@ -38,9 +38,9 @@ struct PyMethodDef { }; typedef struct PyMethodDef PyMethodDef; -extern DL_IMPORT(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *); +PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *); -extern DL_IMPORT(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); +PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); /* Flag passed to newmethodobject */ #define METH_OLDARGS 0x0000 @@ -61,7 +61,7 @@ typedef struct PyMethodChain { struct PyMethodChain *link; /* NULL or base type */ } PyMethodChain; -extern DL_IMPORT(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, +PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, char *); typedef struct { diff --git a/Include/modsupport.h b/Include/modsupport.h index ccbabffd946..2e577ab18e1 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -9,19 +9,19 @@ extern "C" { #include <stdarg.h> -extern DL_IMPORT(int) PyArg_Parse(PyObject *, char *, ...); -extern DL_IMPORT(int) PyArg_ParseTuple(PyObject *, char *, ...); -extern DL_IMPORT(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, +PyAPI_FUNC(int) PyArg_Parse(PyObject *, char *, ...); +PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, char *, ...); +PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, char *, char **, ...); -extern DL_IMPORT(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...); -extern DL_IMPORT(PyObject *) Py_BuildValue(char *, ...); +PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...); +PyAPI_FUNC(PyObject *) Py_BuildValue(char *, ...); -extern DL_IMPORT(int) PyArg_VaParse(PyObject *, char *, va_list); -extern DL_IMPORT(PyObject *) Py_VaBuildValue(char *, va_list); +PyAPI_FUNC(int) PyArg_VaParse(PyObject *, char *, va_list); +PyAPI_FUNC(PyObject *) Py_VaBuildValue(char *, va_list); -extern DL_IMPORT(int) PyModule_AddObject(PyObject *, char *, PyObject *); -extern DL_IMPORT(int) PyModule_AddIntConstant(PyObject *, char *, long); -extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *); +PyAPI_FUNC(int) PyModule_AddObject(PyObject *, char *, PyObject *); +PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, char *, long); +PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *); #define PYTHON_API_VERSION 1011 #define PYTHON_API_STRING "1011" @@ -78,7 +78,7 @@ extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *); #define Py_InitModule4 Py_InitModule4TraceRefs #endif -extern DL_IMPORT(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods, +PyAPI_FUNC(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver); @@ -90,7 +90,7 @@ extern DL_IMPORT(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods, Py_InitModule4(name, methods, doc, (PyObject *)NULL, \ PYTHON_API_VERSION) -extern DL_IMPORT(char *) _Py_PackageContext; +PyAPI_DATA(char *) _Py_PackageContext; #ifdef __cplusplus } diff --git a/Include/moduleobject.h b/Include/moduleobject.h index 533567c3dac..0f67da3ccd8 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -7,16 +7,16 @@ extern "C" { #endif -extern DL_IMPORT(PyTypeObject) PyModule_Type; +PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) ((op)->ob_type == &PyModule_Type) -extern DL_IMPORT(PyObject *) PyModule_New(char *); -extern DL_IMPORT(PyObject *) PyModule_GetDict(PyObject *); -extern DL_IMPORT(char *) PyModule_GetName(PyObject *); -extern DL_IMPORT(char *) PyModule_GetFilename(PyObject *); -extern DL_IMPORT(void) _PyModule_Clear(PyObject *); +PyAPI_FUNC(PyObject *) PyModule_New(char *); +PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); +PyAPI_FUNC(char *) PyModule_GetName(PyObject *); +PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); +PyAPI_FUNC(void) _PyModule_Clear(PyObject *); #ifdef __cplusplus } diff --git a/Include/node.h b/Include/node.h index 59f4d72e6ff..8f5ef236aa8 100644 --- a/Include/node.h +++ b/Include/node.h @@ -15,10 +15,10 @@ typedef struct _node { struct _node *n_child; } node; -extern DL_IMPORT(node *) PyNode_New(int type); -extern DL_IMPORT(int) PyNode_AddChild(node *n, int type, +PyAPI_FUNC(node *) PyNode_New(int type); +PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, char *str, int lineno); -extern DL_IMPORT(void) PyNode_Free(node *n); +PyAPI_FUNC(void) PyNode_Free(node *n); /* Node access functions */ #define NCH(n) ((n)->n_nchildren) @@ -29,7 +29,7 @@ extern DL_IMPORT(void) PyNode_Free(node *n); /* Assert that the type of a node is what we expect */ #define REQ(n, type) assert(TYPE(n) == (type)) -extern DL_IMPORT(void) PyNode_ListTree(node *); +PyAPI_FUNC(void) PyNode_ListTree(node *); #ifdef __cplusplus } diff --git a/Include/objimpl.h b/Include/objimpl.h index 730b032adc1..2b35e67452a 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -94,20 +94,20 @@ PyObject_{New, NewVar, Del}. the object gets initialized via PyObject_{Init, InitVar} after obtaining the raw memory. */ -extern DL_IMPORT(void *) PyObject_Malloc(size_t); -extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t); -extern DL_IMPORT(void) PyObject_Free(void *); +PyAPI_FUNC(void *) PyObject_Malloc(size_t); +PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t); +PyAPI_FUNC(void) PyObject_Free(void *); /* Macros */ #ifdef WITH_PYMALLOC #ifdef PYMALLOC_DEBUG -DL_IMPORT(void *) _PyObject_DebugMalloc(size_t nbytes); -DL_IMPORT(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); -DL_IMPORT(void) _PyObject_DebugFree(void *p); -DL_IMPORT(void) _PyObject_DebugDumpAddress(const void *p); -DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); -DL_IMPORT(void) _PyObject_DebugMallocStats(void); +PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); +PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); +PyAPI_FUNC(void) _PyObject_DebugFree(void *p); +PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p); +PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p); +PyAPI_FUNC(void) _PyObject_DebugMallocStats(void); #define PyObject_MALLOC _PyObject_DebugMalloc #define PyObject_Malloc _PyObject_DebugMalloc #define PyObject_REALLOC _PyObject_DebugRealloc @@ -144,11 +144,11 @@ DL_IMPORT(void) _PyObject_DebugMallocStats(void); */ /* Functions */ -extern DL_IMPORT(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); -extern DL_IMPORT(PyVarObject *) PyObject_InitVar(PyVarObject *, +PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); +PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, PyTypeObject *, int); -extern DL_IMPORT(PyObject *) _PyObject_New(PyTypeObject *); -extern DL_IMPORT(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int); +PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); +PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int); #define PyObject_New(type, typeobj) \ ( (type *) _PyObject_New(typeobj) ) @@ -235,7 +235,7 @@ extern DL_IMPORT(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int); #define PyObject_IS_GC(o) (PyType_IS_GC((o)->ob_type) && \ ((o)->ob_type->tp_is_gc == NULL || (o)->ob_type->tp_is_gc(o))) -extern DL_IMPORT(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, int); +PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, int); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) @@ -286,12 +286,12 @@ extern PyGC_Head *_PyGC_generation0; g->gc.gc_next = NULL; \ } while (0); -extern DL_IMPORT(PyObject *) _PyObject_GC_Malloc(size_t); -extern DL_IMPORT(PyObject *) _PyObject_GC_New(PyTypeObject *); -extern DL_IMPORT(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, int); -extern DL_IMPORT(void) PyObject_GC_Track(void *); -extern DL_IMPORT(void) PyObject_GC_UnTrack(void *); -extern DL_IMPORT(void) PyObject_GC_Del(void *); +PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); +PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); +PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, int); +PyAPI_FUNC(void) PyObject_GC_Track(void *); +PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); +PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ ( (type *) _PyObject_GC_New(typeobj) ) diff --git a/Include/parsetok.h b/Include/parsetok.h index ad337bd2a89..9bcc1f75fa8 100644 --- a/Include/parsetok.h +++ b/Include/parsetok.h @@ -21,18 +21,18 @@ typedef struct { #define PyPARSE_YIELD_IS_KEYWORD 0x0001 #endif -extern DL_IMPORT(node *) PyParser_ParseString(char *, grammar *, int, +PyAPI_FUNC(node *) PyParser_ParseString(char *, grammar *, int, perrdetail *); -extern DL_IMPORT(node *) PyParser_ParseFile (FILE *, char *, grammar *, int, +PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, char *, grammar *, int, char *, char *, perrdetail *); -extern DL_IMPORT(node *) PyParser_ParseStringFlags(char *, grammar *, int, +PyAPI_FUNC(node *) PyParser_ParseStringFlags(char *, grammar *, int, perrdetail *, int); -extern DL_IMPORT(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *, +PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *, int, char *, char *, perrdetail *, int); -extern DL_IMPORT(node *) PyParser_ParseStringFlagsFilename(char *, +PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(char *, char *, grammar *, int, perrdetail *, int); diff --git a/Include/pgenheaders.h b/Include/pgenheaders.h index fecfcc1db56..77acca5132d 100644 --- a/Include/pgenheaders.h +++ b/Include/pgenheaders.h @@ -9,9 +9,9 @@ extern "C" { #include "Python.h" -DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) +PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) __attribute__((format(printf, 1, 2))); -DL_IMPORT(void) PySys_WriteStderr(const char *format, ...) +PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) __attribute__((format(printf, 1, 2))); #define addarc _Py_addarc diff --git a/Include/pyerrors.h b/Include/pyerrors.h index f06d38ca5de..a3d9c5d65ee 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -7,111 +7,111 @@ extern "C" { /* Error handling definitions */ -DL_IMPORT(void) PyErr_SetNone(PyObject *); -DL_IMPORT(void) PyErr_SetObject(PyObject *, PyObject *); -DL_IMPORT(void) PyErr_SetString(PyObject *, const char *); -DL_IMPORT(PyObject *) PyErr_Occurred(void); -DL_IMPORT(void) PyErr_Clear(void); -DL_IMPORT(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); -DL_IMPORT(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(void) PyErr_SetNone(PyObject *); +PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); +PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *); +PyAPI_FUNC(PyObject *) PyErr_Occurred(void); +PyAPI_FUNC(void) PyErr_Clear(void); +PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); +PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); /* Error testing and normalization */ -DL_IMPORT(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); -DL_IMPORT(int) PyErr_ExceptionMatches(PyObject *); -DL_IMPORT(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); +PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); +PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); +PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); /* Predefined exceptions */ -extern DL_IMPORT(PyObject *) PyExc_Exception; -extern DL_IMPORT(PyObject *) PyExc_StopIteration; -extern DL_IMPORT(PyObject *) PyExc_StandardError; -extern DL_IMPORT(PyObject *) PyExc_ArithmeticError; -extern DL_IMPORT(PyObject *) PyExc_LookupError; - -extern DL_IMPORT(PyObject *) PyExc_AssertionError; -extern DL_IMPORT(PyObject *) PyExc_AttributeError; -extern DL_IMPORT(PyObject *) PyExc_EOFError; -extern DL_IMPORT(PyObject *) PyExc_FloatingPointError; -extern DL_IMPORT(PyObject *) PyExc_EnvironmentError; -extern DL_IMPORT(PyObject *) PyExc_IOError; -extern DL_IMPORT(PyObject *) PyExc_OSError; -extern DL_IMPORT(PyObject *) PyExc_ImportError; -extern DL_IMPORT(PyObject *) PyExc_IndexError; -extern DL_IMPORT(PyObject *) PyExc_KeyError; -extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt; -extern DL_IMPORT(PyObject *) PyExc_MemoryError; -extern DL_IMPORT(PyObject *) PyExc_NameError; -extern DL_IMPORT(PyObject *) PyExc_OverflowError; -extern DL_IMPORT(PyObject *) PyExc_RuntimeError; -extern DL_IMPORT(PyObject *) PyExc_NotImplementedError; -extern DL_IMPORT(PyObject *) PyExc_SyntaxError; -extern DL_IMPORT(PyObject *) PyExc_IndentationError; -extern DL_IMPORT(PyObject *) PyExc_TabError; -extern DL_IMPORT(PyObject *) PyExc_ReferenceError; -extern DL_IMPORT(PyObject *) PyExc_SystemError; -extern DL_IMPORT(PyObject *) PyExc_SystemExit; -extern DL_IMPORT(PyObject *) PyExc_TypeError; -extern DL_IMPORT(PyObject *) PyExc_UnboundLocalError; -extern DL_IMPORT(PyObject *) PyExc_UnicodeError; -extern DL_IMPORT(PyObject *) PyExc_ValueError; -extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError; +PyAPI_DATA(PyObject *) PyExc_Exception; +PyAPI_DATA(PyObject *) PyExc_StopIteration; +PyAPI_DATA(PyObject *) PyExc_StandardError; +PyAPI_DATA(PyObject *) PyExc_ArithmeticError; +PyAPI_DATA(PyObject *) PyExc_LookupError; + +PyAPI_DATA(PyObject *) PyExc_AssertionError; +PyAPI_DATA(PyObject *) PyExc_AttributeError; +PyAPI_DATA(PyObject *) PyExc_EOFError; +PyAPI_DATA(PyObject *) PyExc_FloatingPointError; +PyAPI_DATA(PyObject *) PyExc_EnvironmentError; +PyAPI_DATA(PyObject *) PyExc_IOError; +PyAPI_DATA(PyObject *) PyExc_OSError; +PyAPI_DATA(PyObject *) PyExc_ImportError; +PyAPI_DATA(PyObject *) PyExc_IndexError; +PyAPI_DATA(PyObject *) PyExc_KeyError; +PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; +PyAPI_DATA(PyObject *) PyExc_MemoryError; +PyAPI_DATA(PyObject *) PyExc_NameError; +PyAPI_DATA(PyObject *) PyExc_OverflowError; +PyAPI_DATA(PyObject *) PyExc_RuntimeError; +PyAPI_DATA(PyObject *) PyExc_NotImplementedError; +PyAPI_DATA(PyObject *) PyExc_SyntaxError; +PyAPI_DATA(PyObject *) PyExc_IndentationError; +PyAPI_DATA(PyObject *) PyExc_TabError; +PyAPI_DATA(PyObject *) PyExc_ReferenceError; +PyAPI_DATA(PyObject *) PyExc_SystemError; +PyAPI_DATA(PyObject *) PyExc_SystemExit; +PyAPI_DATA(PyObject *) PyExc_TypeError; +PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; +PyAPI_DATA(PyObject *) PyExc_UnicodeError; +PyAPI_DATA(PyObject *) PyExc_ValueError; +PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; #ifdef MS_WINDOWS -extern DL_IMPORT(PyObject *) PyExc_WindowsError; +PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif -extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst; +PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst; /* Predefined warning categories */ -extern DL_IMPORT(PyObject *) PyExc_Warning; -extern DL_IMPORT(PyObject *) PyExc_UserWarning; -extern DL_IMPORT(PyObject *) PyExc_DeprecationWarning; -extern DL_IMPORT(PyObject *) PyExc_PendingDeprecationWarning; -extern DL_IMPORT(PyObject *) PyExc_SyntaxWarning; -extern DL_IMPORT(PyObject *) PyExc_OverflowWarning; -extern DL_IMPORT(PyObject *) PyExc_RuntimeWarning; +PyAPI_DATA(PyObject *) PyExc_Warning; +PyAPI_DATA(PyObject *) PyExc_UserWarning; +PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; +PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; +PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; +PyAPI_DATA(PyObject *) PyExc_OverflowWarning; +PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; /* Convenience functions */ -extern DL_IMPORT(int) PyErr_BadArgument(void); -extern DL_IMPORT(PyObject *) PyErr_NoMemory(void); -extern DL_IMPORT(PyObject *) PyErr_SetFromErrno(PyObject *); -extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); -extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...) +PyAPI_FUNC(int) PyErr_BadArgument(void); +PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); +PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) __attribute__((format(printf, 2, 3))); #ifdef MS_WINDOWS -extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); -extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int); -extern DL_IMPORT(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *,int, const char *); -extern DL_IMPORT(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* Export the old function so that the existing API remains available: */ -extern DL_IMPORT(void) PyErr_BadInternalCall(void); -extern DL_IMPORT(void) _PyErr_BadInternalCall(char *filename, int lineno); +PyAPI_FUNC(void) PyErr_BadInternalCall(void); +PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) /* Function to create a new exception */ -DL_IMPORT(PyObject *) PyErr_NewException(char *name, PyObject *base, +PyAPI_FUNC(PyObject *) PyErr_NewException(char *name, PyObject *base, PyObject *dict); -extern DL_IMPORT(void) PyErr_WriteUnraisable(PyObject *); +PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); /* Issue a warning or exception */ -extern DL_IMPORT(int) PyErr_Warn(PyObject *, char *); -extern DL_IMPORT(int) PyErr_WarnExplicit(PyObject *, char *, +PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *); +PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, char *, char *, int, char *, PyObject *); /* In sigcheck.c or signalmodule.c */ -extern DL_IMPORT(int) PyErr_CheckSignals(void); -extern DL_IMPORT(void) PyErr_SetInterrupt(void); +PyAPI_FUNC(int) PyErr_CheckSignals(void); +PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* Support for adding program text to SyntaxErrors */ -extern DL_IMPORT(void) PyErr_SyntaxLocation(char *, int); -extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); +PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int); +PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int); /* These APIs aren't really part of the error implementation, but often needed to format error messages; the native C lib APIs are @@ -128,9 +128,9 @@ extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); #endif #include <stdarg.h> -extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) +PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); -extern DL_IMPORT(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) +PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) __attribute__((format(printf, 3, 0))); #ifdef __cplusplus diff --git a/Include/pygetopt.h b/Include/pygetopt.h index 9c74cbe9521..80908bea982 100644 --- a/Include/pygetopt.h +++ b/Include/pygetopt.h @@ -5,11 +5,11 @@ extern "C" { #endif -extern DL_IMPORT(int) _PyOS_opterr; -extern DL_IMPORT(int) _PyOS_optind; -extern DL_IMPORT(char *) _PyOS_optarg; +PyAPI_DATA(int) _PyOS_opterr; +PyAPI_DATA(int) _PyOS_optind; +PyAPI_DATA(char *) _PyOS_optarg; -DL_IMPORT(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); +PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); #ifdef __cplusplus } diff --git a/Include/pymem.h b/Include/pymem.h index 183dc758eb2..6b1105ccf72 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -47,9 +47,9 @@ extern "C" { performed on failure (no exception is set, no warning is printed, etc). */ -extern DL_IMPORT(void *) PyMem_Malloc(size_t); -extern DL_IMPORT(void *) PyMem_Realloc(void *, size_t); -extern DL_IMPORT(void) PyMem_Free(void *); +PyAPI_FUNC(void *) PyMem_Malloc(size_t); +PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t); +PyAPI_FUNC(void) PyMem_Free(void *); /* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are no longer supported. They used to call PyErr_NoMemory() on failure. */ diff --git a/Include/pystate.h b/Include/pystate.h index 712e9dc2b56..913dc7a674a 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -74,25 +74,25 @@ typedef struct _ts { } PyThreadState; -DL_IMPORT(PyInterpreterState *) PyInterpreterState_New(void); -DL_IMPORT(void) PyInterpreterState_Clear(PyInterpreterState *); -DL_IMPORT(void) PyInterpreterState_Delete(PyInterpreterState *); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); +PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); +PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); -DL_IMPORT(PyThreadState *) PyThreadState_New(PyInterpreterState *); -DL_IMPORT(void) PyThreadState_Clear(PyThreadState *); -DL_IMPORT(void) PyThreadState_Delete(PyThreadState *); +PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); +PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); +PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); #ifdef WITH_THREAD -DL_IMPORT(void) PyThreadState_DeleteCurrent(void); +PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); #endif -DL_IMPORT(PyThreadState *) PyThreadState_Get(void); -DL_IMPORT(PyThreadState *) PyThreadState_Swap(PyThreadState *); -DL_IMPORT(PyObject *) PyThreadState_GetDict(void); +PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); +PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); +PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); /* Variable and macro for in-line access to current thread state */ -extern DL_IMPORT(PyThreadState *) _PyThreadState_Current; +PyAPI_DATA(PyThreadState *) _PyThreadState_Current; #ifdef Py_DEBUG #define PyThreadState_GET() PyThreadState_Get() @@ -102,10 +102,10 @@ extern DL_IMPORT(PyThreadState *) _PyThreadState_Current; /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ -DL_IMPORT(PyInterpreterState *) PyInterpreterState_Head(void); -DL_IMPORT(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); -DL_IMPORT(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); -DL_IMPORT(PyThreadState *) PyThreadState_Next(PyThreadState *); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); #ifdef __cplusplus } diff --git a/Include/pythonrun.h b/Include/pythonrun.h index 7076dfea2bc..1ee706f8c0c 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -14,69 +14,69 @@ typedef struct { int cf_flags; /* bitmask of CO_xxx flags relevant to future */ } PyCompilerFlags; -DL_IMPORT(void) Py_SetProgramName(char *); -DL_IMPORT(char *) Py_GetProgramName(void); - -DL_IMPORT(void) Py_SetPythonHome(char *); -DL_IMPORT(char *) Py_GetPythonHome(void); - -DL_IMPORT(void) Py_Initialize(void); -DL_IMPORT(void) Py_Finalize(void); -DL_IMPORT(int) Py_IsInitialized(void); -DL_IMPORT(PyThreadState *) Py_NewInterpreter(void); -DL_IMPORT(void) Py_EndInterpreter(PyThreadState *); - -DL_IMPORT(int) PyRun_AnyFile(FILE *, char *); -DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int); - -DL_IMPORT(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); -DL_IMPORT(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); - -DL_IMPORT(int) PyRun_SimpleString(char *); -DL_IMPORT(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *); -DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *); -DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); -DL_IMPORT(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); -DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); -DL_IMPORT(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); -DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); -DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); - -DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); -DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); -DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); -DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *, +PyAPI_FUNC(void) Py_SetProgramName(char *); +PyAPI_FUNC(char *) Py_GetProgramName(void); + +PyAPI_FUNC(void) Py_SetPythonHome(char *); +PyAPI_FUNC(char *) Py_GetPythonHome(void); + +PyAPI_FUNC(void) Py_Initialize(void); +PyAPI_FUNC(void) Py_Finalize(void); +PyAPI_FUNC(int) Py_IsInitialized(void); +PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); +PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); + +PyAPI_FUNC(int) PyRun_AnyFile(FILE *, char *); +PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, char *, int); + +PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); + +PyAPI_FUNC(int) PyRun_SimpleString(char *); +PyAPI_FUNC(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, char *); +PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, char *, int); +PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, char *); +PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, char *); +PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); + +PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(char *, int); +PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); +PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); +PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *, char *, int, int); -DL_IMPORT(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, +PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, int, int); -DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); -DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); -DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int, +PyAPI_FUNC(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, char *, int, PyObject *, PyObject *, int); -DL_IMPORT(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, +PyAPI_FUNC(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, PyCompilerFlags *); -DL_IMPORT(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, +PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, PyObject *, PyCompilerFlags *); -DL_IMPORT(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, +PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, PyObject *, int, PyCompilerFlags *); -DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int); -DL_IMPORT(PyObject *) Py_CompileStringFlags(char *, char *, int, +PyAPI_FUNC(PyObject *) Py_CompileString(char *, char *, int); +PyAPI_FUNC(PyObject *) Py_CompileStringFlags(char *, char *, int, PyCompilerFlags *); -DL_IMPORT(struct symtable *) Py_SymtableString(char *, char *, int); +PyAPI_FUNC(struct symtable *) Py_SymtableString(char *, char *, int); -DL_IMPORT(void) PyErr_Print(void); -DL_IMPORT(void) PyErr_PrintEx(int); -DL_IMPORT(void) PyErr_Display(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(void) PyErr_Print(void); +PyAPI_FUNC(void) PyErr_PrintEx(int); +PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); -DL_IMPORT(int) Py_AtExit(void (*func)(void)); +PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); -DL_IMPORT(void) Py_Exit(int); +PyAPI_FUNC(void) Py_Exit(int); -DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *); +PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, char *); /* Bootstrap */ PyAPI_FUNC(int) Py_Main(int argc, char **argv); @@ -95,9 +95,9 @@ PyAPI_FUNC(const char *) Py_GetCompiler(void); PyAPI_FUNC(const char *) Py_GetBuildInfo(void); /* Internal -- various one-time initializations */ -DL_IMPORT(PyObject *) _PyBuiltin_Init(void); -DL_IMPORT(PyObject *) _PySys_Init(void); -DL_IMPORT(void) _PyImport_Init(void); +PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); +PyAPI_FUNC(PyObject *) _PySys_Init(void); +PyAPI_FUNC(void) _PyImport_Init(void); PyAPI_FUNC(void) _PyExc_Init(void); /* Various internal finalizers */ @@ -113,9 +113,9 @@ PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); /* Stuff with no proper home (yet) */ -DL_IMPORT(char *) PyOS_Readline(char *); -extern DL_IMPORT(int) (*PyOS_InputHook)(void); -extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *); +PyAPI_FUNC(char *) PyOS_Readline(char *); +PyAPI_FUNC(int) (*PyOS_InputHook)(void); +PyAPI_FUNC(char) *(*PyOS_ReadlineFunctionPointer)(char *); /* Stack size, in "pointers" (so we get extra safety margins on 64-bit platforms). On a 32-bit platform, this translates @@ -129,13 +129,13 @@ extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *); #ifdef USE_STACKCHECK /* Check that we aren't overflowing our stack */ -DL_IMPORT(int) PyOS_CheckStack(void); +PyAPI_FUNC(int) PyOS_CheckStack(void); #endif /* Signals */ typedef void (*PyOS_sighandler_t)(int); -DL_IMPORT(PyOS_sighandler_t) PyOS_getsig(int); -DL_IMPORT(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); #ifdef __cplusplus diff --git a/Include/pythread.h b/Include/pythread.h index b1504b6cdb7..8a3bf26afa9 100644 --- a/Include/pythread.h +++ b/Include/pythread.h @@ -12,28 +12,28 @@ typedef void *PyThread_type_sema; extern "C" { #endif -DL_IMPORT(void) PyThread_init_thread(void); -DL_IMPORT(long) PyThread_start_new_thread(void (*)(void *), void *); -DL_IMPORT(void) PyThread_exit_thread(void); -DL_IMPORT(void) PyThread__PyThread_exit_thread(void); -DL_IMPORT(long) PyThread_get_thread_ident(void); - -DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock(void); -DL_IMPORT(void) PyThread_free_lock(PyThread_type_lock); -DL_IMPORT(int) PyThread_acquire_lock(PyThread_type_lock, int); +PyAPI_FUNC(void) PyThread_init_thread(void); +PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); +PyAPI_FUNC(void) PyThread_exit_thread(void); +PyAPI_FUNC(void) PyThread__PyThread_exit_thread(void); +PyAPI_FUNC(long) PyThread_get_thread_ident(void); + +PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); +PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); +PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); #define WAIT_LOCK 1 #define NOWAIT_LOCK 0 -DL_IMPORT(void) PyThread_release_lock(PyThread_type_lock); +PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); #ifndef NO_EXIT_PROG -DL_IMPORT(void) PyThread_exit_prog(int); -DL_IMPORT(void) PyThread__PyThread_exit_prog(int); +PyAPI_FUNC(void) PyThread_exit_prog(int); +PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int); #endif -DL_IMPORT(int) PyThread_create_key(void); -DL_IMPORT(void) PyThread_delete_key(int); -DL_IMPORT(int) PyThread_set_key_value(int, void *); -DL_IMPORT(void *) PyThread_get_key_value(int); +PyAPI_FUNC(int) PyThread_create_key(void); +PyAPI_FUNC(void) PyThread_delete_key(int); +PyAPI_FUNC(int) PyThread_set_key_value(int, void *); +PyAPI_FUNC(void *) PyThread_get_key_value(int); #ifdef __cplusplus } diff --git a/Include/rangeobject.h b/Include/rangeobject.h index ff6dbc28717..b6f571ba32b 100644 --- a/Include/rangeobject.h +++ b/Include/rangeobject.h @@ -15,11 +15,11 @@ Range objects behave like the corresponding tuple objects except that they are represented by a start, stop, and step datamembers. */ -extern DL_IMPORT(PyTypeObject) PyRange_Type; +PyAPI_DATA(PyTypeObject) PyRange_Type; #define PyRange_Check(op) ((op)->ob_type == &PyRange_Type) -extern DL_IMPORT(PyObject *) PyRange_New(long, long, long, int); +PyAPI_FUNC(PyObject *) PyRange_New(long, long, long, int); #ifdef __cplusplus } diff --git a/Include/sliceobject.h b/Include/sliceobject.h index cd40a1bf847..1fb123a94f1 100644 --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -6,7 +6,7 @@ extern "C" { /* The unique ellipsis object "..." */ -extern DL_IMPORT(PyObject) _Py_EllipsisObject; /* Don't use this directly */ +PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ #define Py_Ellipsis (&_Py_EllipsisObject) @@ -24,15 +24,15 @@ typedef struct { PyObject *start, *stop, *step; } PySliceObject; -extern DL_IMPORT(PyTypeObject) PySlice_Type; +PyAPI_DATA(PyTypeObject) PySlice_Type; #define PySlice_Check(op) ((op)->ob_type == &PySlice_Type) -DL_IMPORT(PyObject *) PySlice_New(PyObject* start, PyObject* stop, +PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); -DL_IMPORT(int) PySlice_GetIndices(PySliceObject *r, int length, +PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, int length, int *start, int *stop, int *step); -DL_IMPORT(int) PySlice_GetIndicesEx(PySliceObject *r, int length, +PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, int length, int *start, int *stop, int *step, int *slicelength); diff --git a/Include/stringobject.h b/Include/stringobject.h index 2a56ef639bf..abc8fad625e 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -39,31 +39,31 @@ typedef struct { char ob_sval[1]; } PyStringObject; -extern DL_IMPORT(PyTypeObject) PyBaseString_Type; -extern DL_IMPORT(PyTypeObject) PyString_Type; +PyAPI_DATA(PyTypeObject) PyBaseString_Type; +PyAPI_DATA(PyTypeObject) PyString_Type; #define PyString_Check(op) PyObject_TypeCheck(op, &PyString_Type) #define PyString_CheckExact(op) ((op)->ob_type == &PyString_Type) -extern DL_IMPORT(PyObject *) PyString_FromStringAndSize(const char *, int); -extern DL_IMPORT(PyObject *) PyString_FromString(const char *); -extern DL_IMPORT(PyObject *) PyString_FromFormatV(const char*, va_list) +PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, int); +PyAPI_FUNC(PyObject *) PyString_FromString(const char *); +PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) __attribute__((format(printf, 1, 0))); -extern DL_IMPORT(PyObject *) PyString_FromFormat(const char*, ...) +PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) __attribute__((format(printf, 1, 2))); -extern DL_IMPORT(int) PyString_Size(PyObject *); -extern DL_IMPORT(char *) PyString_AsString(PyObject *); -extern DL_IMPORT(void) PyString_Concat(PyObject **, PyObject *); -extern DL_IMPORT(void) PyString_ConcatAndDel(PyObject **, PyObject *); -extern DL_IMPORT(int) _PyString_Resize(PyObject **, int); -extern DL_IMPORT(int) _PyString_Eq(PyObject *, PyObject*); -extern DL_IMPORT(PyObject *) PyString_Format(PyObject *, PyObject *); -extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int, +PyAPI_FUNC(int) PyString_Size(PyObject *); +PyAPI_FUNC(char *) PyString_AsString(PyObject *); +PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); +PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); +PyAPI_FUNC(int) _PyString_Resize(PyObject **, int); +PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); +PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); -extern DL_IMPORT(void) PyString_InternInPlace(PyObject **); -extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *); -extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void); +PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); +PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); +PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Macro, trading safety for speed */ #define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) @@ -71,14 +71,14 @@ extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void); /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ -extern DL_IMPORT(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); +PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); /* --- Generic Codecs ----------------------------------------------------- */ /* Create an object by decoding the encoded string s of the given size. */ -extern DL_IMPORT(PyObject*) PyString_Decode( +PyAPI_FUNC(PyObject*) PyString_Decode( const char *s, /* encoded string */ int size, /* size of buffer */ const char *encoding, /* encoding */ @@ -88,7 +88,7 @@ extern DL_IMPORT(PyObject*) PyString_Decode( /* Encodes a char buffer of the given size and returns a Python object. */ -extern DL_IMPORT(PyObject*) PyString_Encode( +PyAPI_FUNC(PyObject*) PyString_Encode( const char *s, /* string char buffer */ int size, /* number of chars to encode */ const char *encoding, /* encoding */ @@ -98,7 +98,7 @@ extern DL_IMPORT(PyObject*) PyString_Encode( /* Encodes a string object and returns the result as Python object. */ -extern DL_IMPORT(PyObject*) PyString_AsEncodedObject( +PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -112,7 +112,7 @@ extern DL_IMPORT(PyObject*) PyString_AsEncodedObject( DEPRECATED - use PyString_AsEncodedObject() instead. */ -extern DL_IMPORT(PyObject*) PyString_AsEncodedString( +PyAPI_FUNC(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -121,7 +121,7 @@ extern DL_IMPORT(PyObject*) PyString_AsEncodedString( /* Decodes a string object and returns the result as Python object. */ -extern DL_IMPORT(PyObject*) PyString_AsDecodedObject( +PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -135,7 +135,7 @@ extern DL_IMPORT(PyObject*) PyString_AsDecodedObject( DEPRECATED - use PyString_AsDecodedObject() instead. */ -extern DL_IMPORT(PyObject*) PyString_AsDecodedString( +PyAPI_FUNC(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -147,7 +147,7 @@ extern DL_IMPORT(PyObject*) PyString_AsDecodedString( 0-terminated (passing a string with embedded NULL characters will cause an exception). */ -extern DL_IMPORT(int) PyString_AsStringAndSize( +PyAPI_FUNC(int) PyString_AsStringAndSize( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ register int *len /* pointer to length variable or NULL diff --git a/Include/structmember.h b/Include/structmember.h index 98eccc056e5..69bdc1b8c87 100644 --- a/Include/structmember.h +++ b/Include/structmember.h @@ -81,12 +81,12 @@ typedef struct PyMemberDef { /* Obsolete API, for binary backwards compatibility */ -DL_IMPORT(PyObject *) PyMember_Get(char *, struct memberlist *, char *); -DL_IMPORT(int) PyMember_Set(char *, struct memberlist *, char *, PyObject *); +PyAPI_FUNC(PyObject *) PyMember_Get(char *, struct memberlist *, char *); +PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, char *, PyObject *); /* Current API, use this */ -DL_IMPORT(PyObject *) PyMember_GetOne(char *, struct PyMemberDef *); -DL_IMPORT(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); +PyAPI_FUNC(PyObject *) PyMember_GetOne(char *, struct PyMemberDef *); +PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); #ifdef __cplusplus diff --git a/Include/structseq.h b/Include/structseq.h index b08f04e5c33..67cd947df37 100644 --- a/Include/structseq.h +++ b/Include/structseq.h @@ -19,10 +19,10 @@ typedef struct PyStructSequence_Desc { int n_in_sequence; } PyStructSequence_Desc; -extern DL_IMPORT(void) PyStructSequence_InitType(PyTypeObject *type, +PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc); -extern DL_IMPORT(PyObject *) PyStructSequence_New(PyTypeObject* type); +PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); typedef struct { PyObject_VAR_HEAD diff --git a/Include/symtable.h b/Include/symtable.h index 8bfe9aa5f42..9bf2a2a3f11 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -50,15 +50,15 @@ typedef struct _symtable_entry { struct symtable *ste_table; } PySymtableEntryObject; -extern DL_IMPORT(PyTypeObject) PySymtableEntry_Type; +PyAPI_DATA(PyTypeObject) PySymtableEntry_Type; #define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type) -extern DL_IMPORT(PyObject *) PySymtableEntry_New(struct symtable *, +PyAPI_FUNC(PyObject *) PySymtableEntry_New(struct symtable *, char *, int, int); -DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); -DL_IMPORT(void) PySymtable_Free(struct symtable *); +PyAPI_FUNC(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); +PyAPI_FUNC(void) PySymtable_Free(struct symtable *); #define TOP "global" diff --git a/Include/sysmodule.h b/Include/sysmodule.h index ca6b6d78982..4f05ac91f19 100644 --- a/Include/sysmodule.h +++ b/Include/sysmodule.h @@ -7,22 +7,22 @@ extern "C" { #endif -DL_IMPORT(PyObject *) PySys_GetObject(char *); -DL_IMPORT(int) PySys_SetObject(char *, PyObject *); -DL_IMPORT(FILE *) PySys_GetFile(char *, FILE *); -DL_IMPORT(void) PySys_SetArgv(int, char **); -DL_IMPORT(void) PySys_SetPath(char *); +PyAPI_FUNC(PyObject *) PySys_GetObject(char *); +PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *); +PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); +PyAPI_FUNC(void) PySys_SetArgv(int, char **); +PyAPI_FUNC(void) PySys_SetPath(char *); -DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) +PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) __attribute__((format(printf, 1, 2))); -DL_IMPORT(void) PySys_WriteStderr(const char *format, ...) +PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) __attribute__((format(printf, 1, 2))); -extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; -extern DL_IMPORT(int) _PySys_CheckInterval; +PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; +PyAPI_DATA(int) _PySys_CheckInterval; -DL_IMPORT(void) PySys_ResetWarnOptions(void); -DL_IMPORT(void) PySys_AddWarnOption(char *); +PyAPI_FUNC(void) PySys_ResetWarnOptions(void); +PyAPI_FUNC(void) PySys_AddWarnOption(char *); #ifdef __cplusplus } diff --git a/Include/token.h b/Include/token.h index 3f581065da5..4e2ec06b686 100644 --- a/Include/token.h +++ b/Include/token.h @@ -71,10 +71,10 @@ extern "C" { #define ISEOF(x) ((x) == ENDMARKER) -extern DL_IMPORT(char *) _PyParser_TokenNames[]; /* Token names */ -extern DL_IMPORT(int) PyToken_OneChar(int); -extern DL_IMPORT(int) PyToken_TwoChars(int, int); -extern DL_IMPORT(int) PyToken_ThreeChars(int, int, int); +PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ +PyAPI_FUNC(int) PyToken_OneChar(int); +PyAPI_FUNC(int) PyToken_TwoChars(int, int); +PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); #ifdef __cplusplus } diff --git a/Include/traceback.h b/Include/traceback.h index 68790438cb8..659e994301b 100644 --- a/Include/traceback.h +++ b/Include/traceback.h @@ -9,11 +9,11 @@ extern "C" { struct _frame; -DL_IMPORT(int) PyTraceBack_Here(struct _frame *); -DL_IMPORT(int) PyTraceBack_Print(PyObject *, PyObject *); +PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); +PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); /* Reveal traceback type so we can typecheck traceback objects */ -extern DL_IMPORT(PyTypeObject) PyTraceBack_Type; +PyAPI_DATA(PyTypeObject) PyTraceBack_Type; #define PyTraceBack_Check(v) ((v)->ob_type == &PyTraceBack_Type) #ifdef __cplusplus diff --git a/Include/tupleobject.h b/Include/tupleobject.h index c5ec1c2cec9..58bf8968e07 100644 --- a/Include/tupleobject.h +++ b/Include/tupleobject.h @@ -24,17 +24,17 @@ typedef struct { PyObject *ob_item[1]; } PyTupleObject; -extern DL_IMPORT(PyTypeObject) PyTuple_Type; +PyAPI_DATA(PyTypeObject) PyTuple_Type; #define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type) #define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type) -extern DL_IMPORT(PyObject *) PyTuple_New(int size); -extern DL_IMPORT(int) PyTuple_Size(PyObject *); -extern DL_IMPORT(PyObject *) PyTuple_GetItem(PyObject *, int); -extern DL_IMPORT(int) PyTuple_SetItem(PyObject *, int, PyObject *); -extern DL_IMPORT(PyObject *) PyTuple_GetSlice(PyObject *, int, int); -extern DL_IMPORT(int) _PyTuple_Resize(PyObject **, int); +PyAPI_FUNC(PyObject *) PyTuple_New(int size); +PyAPI_FUNC(int) PyTuple_Size(PyObject *); +PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, int); +PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, int, PyObject *); +PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, int, int); +PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, int); /* Macro, trading safety for speed */ #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 2a92fe52aca..5e259ba03d5 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -371,7 +371,7 @@ typedef struct { implementing the buffer protocol */ } PyUnicodeObject; -extern DL_IMPORT(PyTypeObject) PyUnicode_Type; +PyAPI_DATA(PyTypeObject) PyUnicode_Type; #define PyUnicode_Check(op) PyObject_TypeCheck(op, &PyUnicode_Type) #define PyUnicode_CheckExact(op) ((op)->ob_type == &PyUnicode_Type) @@ -409,7 +409,7 @@ extern DL_IMPORT(PyTypeObject) PyUnicode_Type; The buffer is copied into the new object. */ -extern DL_IMPORT(PyObject*) PyUnicode_FromUnicode( +PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( const Py_UNICODE *u, /* Unicode buffer */ int size /* size of buffer */ ); @@ -417,18 +417,18 @@ extern DL_IMPORT(PyObject*) PyUnicode_FromUnicode( /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. */ -extern DL_IMPORT(Py_UNICODE *) PyUnicode_AsUnicode( +PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); /* Get the length of the Unicode object. */ -extern DL_IMPORT(int) PyUnicode_GetSize( +PyAPI_FUNC(int) PyUnicode_GetSize( PyObject *unicode /* Unicode object */ ); /* Get the maximum ordinal for a Unicode character. */ -extern DL_IMPORT(Py_UNICODE) PyUnicode_GetMax(void); +PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); /* Resize an already allocated Unicode object to the new size length. @@ -444,7 +444,7 @@ extern DL_IMPORT(Py_UNICODE) PyUnicode_GetMax(void); */ -extern DL_IMPORT(int) PyUnicode_Resize( +PyAPI_FUNC(int) PyUnicode_Resize( PyObject **unicode, /* Pointer to the Unicode object */ int length /* New length */ ); @@ -466,7 +466,7 @@ extern DL_IMPORT(int) PyUnicode_Resize( */ -extern DL_IMPORT(PyObject*) PyUnicode_FromEncodedObject( +PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( register PyObject *obj, /* Object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -485,7 +485,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_FromEncodedObject( */ -extern DL_IMPORT(PyObject*) PyUnicode_FromObject( +PyAPI_FUNC(PyObject*) PyUnicode_FromObject( register PyObject *obj /* Object */ ); @@ -498,7 +498,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_FromObject( The buffer is copied into the new object. */ -extern DL_IMPORT(PyObject*) PyUnicode_FromWideChar( +PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( register const wchar_t *w, /* wchar_t buffer */ int size /* size of buffer */ ); @@ -509,7 +509,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_FromWideChar( Returns the number of wchar_t characters copied or -1 in case of an error. */ -extern DL_IMPORT(int) PyUnicode_AsWideChar( +PyAPI_FUNC(int) PyUnicode_AsWideChar( PyUnicodeObject *unicode, /* Unicode object */ register wchar_t *w, /* wchar_t buffer */ int size /* size of buffer */ @@ -563,7 +563,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_FromOrdinal(int ordinal); */ -extern DL_IMPORT(PyObject *) _PyUnicode_AsDefaultEncodedString( +PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString( PyObject *, const char *); /* Returns the currently active default encoding. @@ -575,7 +575,7 @@ extern DL_IMPORT(PyObject *) _PyUnicode_AsDefaultEncodedString( */ -extern DL_IMPORT(const char*) PyUnicode_GetDefaultEncoding(void); +PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); /* Sets the currently active default encoding. @@ -583,7 +583,7 @@ extern DL_IMPORT(const char*) PyUnicode_GetDefaultEncoding(void); */ -extern DL_IMPORT(int) PyUnicode_SetDefaultEncoding( +PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( const char *encoding /* Encoding name in standard form */ ); @@ -592,7 +592,7 @@ extern DL_IMPORT(int) PyUnicode_SetDefaultEncoding( /* Create a Unicode object by decoding the encoded string s of the given size. */ -extern DL_IMPORT(PyObject*) PyUnicode_Decode( +PyAPI_FUNC(PyObject*) PyUnicode_Decode( const char *s, /* encoded string */ int size, /* size of buffer */ const char *encoding, /* encoding */ @@ -602,7 +602,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_Decode( /* Encodes a Py_UNICODE buffer of the given size and returns a Python string object. */ -extern DL_IMPORT(PyObject*) PyUnicode_Encode( +PyAPI_FUNC(PyObject*) PyUnicode_Encode( const Py_UNICODE *s, /* Unicode char buffer */ int size, /* number of Py_UNICODE chars to encode */ const char *encoding, /* encoding */ @@ -612,7 +612,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_Encode( /* Encodes a Unicode object and returns the result as Python string object. */ -extern DL_IMPORT(PyObject*) PyUnicode_AsEncodedString( +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -620,13 +620,13 @@ extern DL_IMPORT(PyObject*) PyUnicode_AsEncodedString( /* --- UTF-7 Codecs ------------------------------------------------------- */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF7( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( const char *string, /* UTF-7 encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF7( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ int encodeSetO, /* force the encoder to encode characters in @@ -638,17 +638,17 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF7( /* --- UTF-8 Codecs ------------------------------------------------------- */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF8( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( const char *string, /* UTF-8 encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsUTF8String( +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( PyObject *unicode /* Unicode object */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF8( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ const char *errors /* error handling */ @@ -679,7 +679,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF8( */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF16( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( const char *string, /* UTF-16 encoded string */ int length, /* size of string */ const char *errors, /* error handling */ @@ -691,7 +691,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF16( /* Returns a Python string using the UTF-16 encoding in native byte order. The string always starts with a BOM mark. */ -extern DL_IMPORT(PyObject*) PyUnicode_AsUTF16String( +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( PyObject *unicode /* Unicode object */ ); @@ -715,7 +715,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_AsUTF16String( */ -extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF16( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ @@ -724,34 +724,34 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF16( /* --- Unicode-Escape Codecs ---------------------------------------------- */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeUnicodeEscape( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( const char *string, /* Unicode-Escape encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsUnicodeEscapeString( +PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeUnicodeEscape( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ int length /* Number of Py_UNICODE chars to encode */ ); /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeRawUnicodeEscape( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( const char *string, /* Raw-Unicode-Escape encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsRawUnicodeEscapeString( +PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeRawUnicodeEscape( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ int length /* Number of Py_UNICODE chars to encode */ ); @@ -762,17 +762,17 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeRawUnicodeEscape( */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeLatin1( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( const char *string, /* Latin-1 encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsLatin1String( +PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( PyObject *unicode /* Unicode object */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeLatin1( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ @@ -784,17 +784,17 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeLatin1( */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeASCII( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( const char *string, /* ASCII encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsASCIIString( +PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( PyObject *unicode /* Unicode object */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeASCII( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ @@ -822,7 +822,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeASCII( */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeCharmap( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( const char *string, /* Encoded string */ int length, /* size of string */ PyObject *mapping, /* character mapping @@ -830,13 +830,13 @@ extern DL_IMPORT(PyObject*) PyUnicode_DecodeCharmap( const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsCharmapString( +PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( PyObject *unicode, /* Unicode object */ PyObject *mapping /* character mapping (unicode ordinal -> char ordinal) */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeCharmap( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ PyObject *mapping, /* character mapping @@ -857,7 +857,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeCharmap( */ -extern DL_IMPORT(PyObject *) PyUnicode_TranslateCharmap( +PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ PyObject *table, /* Translate table */ @@ -868,17 +868,17 @@ extern DL_IMPORT(PyObject *) PyUnicode_TranslateCharmap( /* --- MBCS codecs for Windows -------------------------------------------- */ -extern DL_IMPORT(PyObject*) PyUnicode_DecodeMBCS( +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( const char *string, /* MBCS encoded string */ int length, /* size of string */ const char *errors /* error handling */ ); -extern DL_IMPORT(PyObject*) PyUnicode_AsMBCSString( +PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ ); -extern DL_IMPORT(PyObject*) PyUnicode_EncodeMBCS( +PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ @@ -910,7 +910,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_EncodeMBCS( */ -extern DL_IMPORT(int) PyUnicode_EncodeDecimal( +PyAPI_FUNC(int) PyUnicode_EncodeDecimal( Py_UNICODE *s, /* Unicode buffer */ int length, /* Number of Py_UNICODE chars to encode */ char *output, /* Output buffer; must have size >= length */ @@ -925,7 +925,7 @@ extern DL_IMPORT(int) PyUnicode_EncodeDecimal( /* Concat two strings giving a new Unicode string. */ -extern DL_IMPORT(PyObject*) PyUnicode_Concat( +PyAPI_FUNC(PyObject*) PyUnicode_Concat( PyObject *left, /* Left string */ PyObject *right /* Right string */ ); @@ -941,7 +941,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_Concat( */ -extern DL_IMPORT(PyObject*) PyUnicode_Split( +PyAPI_FUNC(PyObject*) PyUnicode_Split( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ int maxsplit /* Maxsplit count */ @@ -952,7 +952,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_Split( CRLF is considered to be one line break. Line breaks are not included in the resulting list. */ -extern DL_IMPORT(PyObject*) PyUnicode_Splitlines( +PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( PyObject *s, /* String to split */ int keepends /* If true, line end markers are included */ ); @@ -969,7 +969,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_Splitlines( */ -extern DL_IMPORT(PyObject *) PyUnicode_Translate( +PyAPI_FUNC(PyObject *) PyUnicode_Translate( PyObject *str, /* String */ PyObject *table, /* Translate table */ const char *errors /* error handling */ @@ -978,7 +978,7 @@ extern DL_IMPORT(PyObject *) PyUnicode_Translate( /* Join a sequence of strings using the given separator and return the resulting Unicode string. */ -extern DL_IMPORT(PyObject*) PyUnicode_Join( +PyAPI_FUNC(PyObject*) PyUnicode_Join( PyObject *separator, /* Separator string */ PyObject *seq /* Sequence object */ ); @@ -986,7 +986,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_Join( /* Return 1 if substr matches str[start:end] at the given tail end, 0 otherwise. */ -extern DL_IMPORT(int) PyUnicode_Tailmatch( +PyAPI_FUNC(int) PyUnicode_Tailmatch( PyObject *str, /* String */ PyObject *substr, /* Prefix or Suffix string */ int start, /* Start index */ @@ -998,7 +998,7 @@ extern DL_IMPORT(int) PyUnicode_Tailmatch( given search direction or -1 if not found. -2 is returned in case an error occurred and an exception is set. */ -extern DL_IMPORT(int) PyUnicode_Find( +PyAPI_FUNC(int) PyUnicode_Find( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ int start, /* Start index */ @@ -1008,7 +1008,7 @@ extern DL_IMPORT(int) PyUnicode_Find( /* Count the number of occurrences of substr in str[start:end]. */ -extern DL_IMPORT(int) PyUnicode_Count( +PyAPI_FUNC(int) PyUnicode_Count( PyObject *str, /* String */ PyObject *substr, /* Substring to count */ int start, /* Start index */ @@ -1018,7 +1018,7 @@ extern DL_IMPORT(int) PyUnicode_Count( /* Replace at most maxcount occurrences of substr in str with replstr and return the resulting Unicode object. */ -extern DL_IMPORT(PyObject *) PyUnicode_Replace( +PyAPI_FUNC(PyObject *) PyUnicode_Replace( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ PyObject *replstr, /* Substring to replace */ @@ -1029,7 +1029,7 @@ extern DL_IMPORT(PyObject *) PyUnicode_Replace( /* Compare two strings and return -1, 0, 1 for less than, equal, greater than resp. */ -extern DL_IMPORT(int) PyUnicode_Compare( +PyAPI_FUNC(int) PyUnicode_Compare( PyObject *left, /* Left string */ PyObject *right /* Right string */ ); @@ -1037,7 +1037,7 @@ extern DL_IMPORT(int) PyUnicode_Compare( /* Apply a argument tuple or dictionary to a format string and return the resulting Unicode string. */ -extern DL_IMPORT(PyObject *) PyUnicode_Format( +PyAPI_FUNC(PyObject *) PyUnicode_Format( PyObject *format, /* Format string */ PyObject *args /* Argument tuple or dictionary */ ); @@ -1048,13 +1048,13 @@ extern DL_IMPORT(PyObject *) PyUnicode_Format( element has to coerce to an one element Unicode string. -1 is returned in case of an error. */ -extern DL_IMPORT(int) PyUnicode_Contains( +PyAPI_FUNC(int) PyUnicode_Contains( PyObject *container, /* Container string */ PyObject *element /* Element string */ ); /* Externally visible for str.strip(unicode) */ -extern DL_IMPORT(PyObject *) _PyUnicode_XStrip( +PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( PyUnicodeObject *self, int striptype, PyObject *sepobj @@ -1069,63 +1069,63 @@ extern DL_IMPORT(PyObject *) _PyUnicode_XStrip( */ -extern DL_IMPORT(int) _PyUnicode_IsLowercase( +PyAPI_FUNC(int) _PyUnicode_IsLowercase( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsUppercase( +PyAPI_FUNC(int) _PyUnicode_IsUppercase( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsTitlecase( +PyAPI_FUNC(int) _PyUnicode_IsTitlecase( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsWhitespace( +PyAPI_FUNC(int) _PyUnicode_IsWhitespace( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsLinebreak( +PyAPI_FUNC(int) _PyUnicode_IsLinebreak( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToLowercase( +PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToUppercase( +PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToTitlecase( +PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_ToDecimalDigit( +PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_ToDigit( +PyAPI_FUNC(int) _PyUnicode_ToDigit( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(double) _PyUnicode_ToNumeric( +PyAPI_FUNC(double) _PyUnicode_ToNumeric( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsDecimalDigit( +PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsDigit( +PyAPI_FUNC(int) _PyUnicode_IsDigit( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsNumeric( +PyAPI_FUNC(int) _PyUnicode_IsNumeric( Py_UNICODE ch /* Unicode character */ ); -extern DL_IMPORT(int) _PyUnicode_IsAlpha( +PyAPI_FUNC(int) _PyUnicode_IsAlpha( Py_UNICODE ch /* Unicode character */ ); diff --git a/Include/weakrefobject.h b/Include/weakrefobject.h index 6ead22b5157..b6fc389f671 100644 --- a/Include/weakrefobject.h +++ b/Include/weakrefobject.h @@ -18,9 +18,9 @@ struct _PyWeakReference { PyWeakReference *wr_next; }; -extern DL_IMPORT(PyTypeObject) _PyWeakref_RefType; -extern DL_IMPORT(PyTypeObject) _PyWeakref_ProxyType; -extern DL_IMPORT(PyTypeObject) _PyWeakref_CallableProxyType; +PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; +PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; +PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) \ ((op)->ob_type == &_PyWeakref_RefType) @@ -31,13 +31,13 @@ extern DL_IMPORT(PyTypeObject) _PyWeakref_CallableProxyType; (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) -extern DL_IMPORT(PyObject *) PyWeakref_NewRef(PyObject *ob, +PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, PyObject *callback); -extern DL_IMPORT(PyObject *) PyWeakref_NewProxy(PyObject *ob, +PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, PyObject *callback); -extern DL_IMPORT(PyObject *) PyWeakref_GetObject(PyObject *ref); +PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); -extern DL_IMPORT(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head); +PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head); #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) |