Thanks to Skip Montanaro and Kalle Svensson for the patches.
#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(). */
*/
#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
*/
- 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
- DL_IMPORT(PyObject *) PyObject_Call(PyObject *callable_object,
+ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
PyObject *args, PyObject *kw);
/*
*/
- DL_IMPORT(PyObject *) PyObject_CallObject(PyObject *callable_object,
+ PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
PyObject *args);
/*
*/
- DL_IMPORT(PyObject *) PyObject_CallFunction(PyObject *callable_object,
+ PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
char *format, ...);
/*
*/
- DL_IMPORT(PyObject *) PyObject_CallMethod(PyObject *o, char *m,
+ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m,
char *format, ...);
/*
*/
- DL_IMPORT(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
+ PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
...);
/*
*/
- DL_IMPORT(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
+ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
PyObject *m, ...);
/*
*/
- DL_IMPORT(PyObject *) PyObject_Type(PyObject *o);
+ PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o);
/*
On success, returns a type object corresponding to the object
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
/* 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
*/
- 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
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.
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);
*/
- DL_IMPORT(int) PyObject_CheckReadBuffer(PyObject *obj);
+ PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
/*
Checks whether an arbitrary object supports the (character,
*/
- DL_IMPORT(int) PyObject_AsReadBuffer(PyObject *obj,
+ PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
const void **buffer,
int *buffer_len);
*/
- DL_IMPORT(int) PyObject_AsWriteBuffer(PyObject *obj,
+ PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
void **buffer,
int *buffer_len);
/* 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. */
(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.
/* 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
*/
- 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.
*/
- 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
*/
- 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
*/
- 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.
*/
- 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,
*/
- 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,
*/
- 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
*/
- 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.
*/
- DL_IMPORT(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
+ PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
PyObject *o3);
/*
*/
- 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.
*/
- 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.
*/
- 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
*/
- 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
*/
- 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
*/
- 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
*/
- 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
*/
- 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
*/
- 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
*/
- 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
*/
- 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,
*/
- 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
/* 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
*/
- 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
*/
- 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
*/
- 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
*/
- DL_IMPORT(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
+ PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
PyObject *o2);
/*
*/
- DL_IMPORT(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
+ PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
PyObject *o2);
/*
*/
- 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
*/
- DL_IMPORT(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
+ PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
PyObject *o3);
/*
*/
- 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
*/
- 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
*/
- 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,
*/
- 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
*/
- 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,
/* 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
*/
- 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.
/* 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
*/
- 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,
*/
- 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
*/
- 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
*/
- 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
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);
/*
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.
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.
*/
- 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
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,
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().
#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:
/* 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
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,
/* 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
*/
- 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
/* 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
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
/* 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
*/
#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,
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,
*/
#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
o[key].
*/
- DL_IMPORT(int) PyMapping_SetItemString(PyObject *o, char *key,
+ PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key,
PyObject *value);
/*
*/
-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) */
typedef PyIntObject PyBoolObject;
-extern DL_IMPORT(PyTypeObject) PyBool_Type;
+PyAPI_DATA(PyTypeObject) PyBool_Type;
#define PyBool_Check(x) ((x)->ob_type == &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
}
#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
}
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)
/* 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.
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; \
#endif /* !WITH_THREAD */
-extern DL_IMPORT(int) _PyEval_SliceIndex(PyObject *, int *);
+PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, int *);
#ifdef __cplusplus
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. */
#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
extern "C" {
#endif
-extern DL_IMPORT(PyTypeObject) PyCObject_Type;
+PyAPI_DATA(PyTypeObject) PyCObject_Type;
#define PyCObject_Check(op) ((op)->ob_type == &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,
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
}
The search_function's refcount is incremented by this function. */
-extern DL_IMPORT(int) PyCodec_Register(
+PyAPI_FUNC(int) PyCodec_Register(
PyObject *search_function
);
*/
-extern DL_IMPORT(PyObject *) _PyCodec_Lookup(
+PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
const char *encoding
);
*/
-extern DL_IMPORT(PyObject *) PyCodec_Encode(
+PyAPI_FUNC(PyObject *) PyCodec_Encode(
PyObject *object,
const char *encoding,
const char *errors
*/
-extern DL_IMPORT(PyObject *) PyCodec_Decode(
+PyAPI_FUNC(PyObject *) PyCodec_Decode(
PyObject *object,
const char *encoding,
const char *errors
/* 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
/* 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
#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))
/* 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 */
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"
#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 */
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
}
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
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);
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
}
extern "C" {
#endif
-extern DL_IMPORT(PyTypeObject) PyEnum_Type;
+PyAPI_DATA(PyTypeObject) PyEnum_Type;
#ifdef __cplusplus
}
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,
#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
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)
/* 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
}
/* 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 *);
/* 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
}
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. */
(((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
}
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
}
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
}
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
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])
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
}
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.
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
+ 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);
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);
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
}
extern "C" {
#endif
-extern DL_IMPORT(PyTypeObject) PyCFunction_Type;
+PyAPI_DATA(PyTypeObject) PyCFunction_Type;
#define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
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. */
(((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;
};
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
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 {
#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"
#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);
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
PYTHON_API_VERSION)
-extern DL_IMPORT(char *) _Py_PackageContext;
+PyAPI_DATA(char *) _Py_PackageContext;
#ifdef __cplusplus
}
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
}
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)
/* 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
}
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
*/
/* 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) )
#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)) )
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) )
#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);
#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
/* 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
#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
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
}
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. */
} 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()
/* 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
}
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);
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 */
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
#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
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
}
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
}
/* 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)
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);
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)
/* _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 */
/* 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 */
/* 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 */
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 */
/* 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 */
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 */
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
/* 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
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
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"
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
}
#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
}
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
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])
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)
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 */
);
/* 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.
*/
-extern DL_IMPORT(int) PyUnicode_Resize(
+PyAPI_FUNC(int) PyUnicode_Resize(
PyObject **unicode, /* Pointer to the Unicode object */
int length /* New length */
);
*/
-extern DL_IMPORT(PyObject*) PyUnicode_FromEncodedObject(
+PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
register PyObject *obj, /* Object */
const char *encoding, /* encoding */
const char *errors /* error handling */
*/
-extern DL_IMPORT(PyObject*) PyUnicode_FromObject(
+PyAPI_FUNC(PyObject*) PyUnicode_FromObject(
register PyObject *obj /* Object */
);
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 */
);
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 */
*/
-extern DL_IMPORT(PyObject *) _PyUnicode_AsDefaultEncodedString(
+PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
PyObject *, const char *);
/* Returns the currently active default encoding.
*/
-extern DL_IMPORT(const char*) PyUnicode_GetDefaultEncoding(void);
+PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);
/* Sets the currently active default encoding.
*/
-extern DL_IMPORT(int) PyUnicode_SetDefaultEncoding(
+PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding(
const char *encoding /* Encoding name in standard form */
);
/* 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 */
/* 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 */
/* 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 */
/* --- 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
/* --- 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 */
*/
-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 */
/* 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 */
);
*/
-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 */
/* --- 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 */
);
*/
-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 */
*/
-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 */
*/
-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
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
*/
-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 */
/* --- 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 */
*/
-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 */
/* 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 */
);
*/
-extern DL_IMPORT(PyObject*) PyUnicode_Split(
+PyAPI_FUNC(PyObject*) PyUnicode_Split(
PyObject *s, /* String to split */
PyObject *sep, /* String separator */
int maxsplit /* Maxsplit count */
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 */
);
*/
-extern DL_IMPORT(PyObject *) PyUnicode_Translate(
+PyAPI_FUNC(PyObject *) PyUnicode_Translate(
PyObject *str, /* String */
PyObject *table, /* Translate table */
const char *errors /* error handling */
/* 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 */
);
/* 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 */
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 */
/* 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 */
/* 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 */
/* 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 */
);
/* 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 */
);
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
*/
-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 */
);
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)
(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)