-
Notifications
You must be signed in to change notification settings - Fork 10
/
compat.h
63 lines (57 loc) · 1.65 KB
/
compat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* The Python Imaging Library.
*
* compatibility macros for the Python bindings
*
* history:
* 2011-01-10 fl Created
*
* Copyright (c) 1997-2011 by Secret Labs AB
* Copyright (c) 1995-2011 by Fredrik Lundh
*
* See the README file for information on usage and redistribution.
*/
#if PY_VERSION_HEX < 0x01060000
#define PyObject_New PyObject_NEW
#define PyObject_Del PyMem_DEL
#endif
#if PY_VERSION_HEX >= 0x01060000
#if PY_VERSION_HEX < 0x02020000 || defined(Py_USING_UNICODE)
/* defining this enables unicode support (default under 1.6a1 and later) */
#define HAVE_UNICODE
#endif
#endif
#if PY_VERSION_HEX < 0x02030000
#define PyMODINIT_FUNC DL_EXPORT(void)
#define PyLong_AsUnsignedLongMask PyLong_AsUnsignedLong
#endif
#if PY_VERSION_HEX < 0x02050000
#define Py_ssize_t int
#define lenfunc inquiry
#define ssizeargfunc intargfunc
#define ssizessizeargfunc intintargfunc
#define ssizeobjargproc intobjargproc
#define ssizessizeobjargproc intintobjargproc
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_TYPE(op) (op)->ob_type
#endif
#if PY_VERSION_HEX < 0x03000000
#define PY2
#define ARG(a,b) a
#else
#define ARG(a,b) b
#define PyIntObject PyLongObject
#define PyInt_Check PyLong_Check
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_FromLong PyLong_FromLong
#define PyStringObject PyBytesObject
#define PyString_Check PyBytes_Check
#define PyString_AsString PyBytes_AsString
#define PyString_AS_STRING PyBytes_AS_STRING
#define PyString_GET_SIZE PyBytes_GET_SIZE
#define PyString_FromString PyBytes_FromString
#define PyString_FromStringAndSize PyBytes_FromStringAndSize
#define _PyString_Resize _PyBytes_Resize
#endif