##// END OF EJS Templates
util.h: Add a PyInt_AsLong definition for usage in the inotify module.
Renato Cunha -
r11534:9777a3b1 default
parent child Browse files
Show More
@@ -1,63 +1,64
1 /*
1 /*
2 util.h - utility functions for interfacing with the various python APIs.
2 util.h - utility functions for interfacing with the various python APIs.
3
3
4 This software may be used and distributed according to the terms of
4 This software may be used and distributed according to the terms of
5 the GNU General Public License, incorporated herein by reference.
5 the GNU General Public License, incorporated herein by reference.
6 */
6 */
7
7
8 #ifndef _HG_UTIL_H_
8 #ifndef _HG_UTIL_H_
9 #define _HG_UTIL_H_
9 #define _HG_UTIL_H_
10
10
11 #if PY_MAJOR_VERSION >= 3
11 #if PY_MAJOR_VERSION >= 3
12
12
13 #define IS_PY3K
13 #define IS_PY3K
14 #define PyInt_FromLong PyLong_FromLong
14 #define PyInt_FromLong PyLong_FromLong
15 #define PyInt_AsLong PyLong_AsLong
15
16
16 #endif /* PY_MAJOR_VERSION */
17 #endif /* PY_MAJOR_VERSION */
17
18
18 /* Backports from 2.6 */
19 /* Backports from 2.6 */
19 #if PY_VERSION_HEX < 0x02060000
20 #if PY_VERSION_HEX < 0x02060000
20
21
21 #define Py_TYPE(ob) (ob)->ob_type
22 #define Py_TYPE(ob) (ob)->ob_type
22 #define Py_SIZE(ob) (ob)->ob_size
23 #define Py_SIZE(ob) (ob)->ob_size
23 #define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
24 #define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
24
25
25 /* Shamelessly stolen from bytesobject.h */
26 /* Shamelessly stolen from bytesobject.h */
26 #define PyBytesObject PyStringObject
27 #define PyBytesObject PyStringObject
27 #define PyBytes_Type PyString_Type
28 #define PyBytes_Type PyString_Type
28
29
29 #define PyBytes_Check PyString_Check
30 #define PyBytes_Check PyString_Check
30 #define PyBytes_CheckExact PyString_CheckExact
31 #define PyBytes_CheckExact PyString_CheckExact
31 #define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED
32 #define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED
32 #define PyBytes_AS_STRING PyString_AS_STRING
33 #define PyBytes_AS_STRING PyString_AS_STRING
33 #define PyBytes_GET_SIZE PyString_GET_SIZE
34 #define PyBytes_GET_SIZE PyString_GET_SIZE
34 #define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS
35 #define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS
35
36
36 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
37 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
37 #define PyBytes_FromString PyString_FromString
38 #define PyBytes_FromString PyString_FromString
38 #define PyBytes_FromFormatV PyString_FromFormatV
39 #define PyBytes_FromFormatV PyString_FromFormatV
39 #define PyBytes_FromFormat PyString_FromFormat
40 #define PyBytes_FromFormat PyString_FromFormat
40 #define PyBytes_Size PyString_Size
41 #define PyBytes_Size PyString_Size
41 #define PyBytes_AsString PyString_AsString
42 #define PyBytes_AsString PyString_AsString
42 #define PyBytes_Repr PyString_Repr
43 #define PyBytes_Repr PyString_Repr
43 #define PyBytes_Concat PyString_Concat
44 #define PyBytes_Concat PyString_Concat
44 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
45 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
45 #define _PyBytes_Resize _PyString_Resize
46 #define _PyBytes_Resize _PyString_Resize
46 #define _PyBytes_Eq _PyString_Eq
47 #define _PyBytes_Eq _PyString_Eq
47 #define PyBytes_Format PyString_Format
48 #define PyBytes_Format PyString_Format
48 #define _PyBytes_FormatLong _PyString_FormatLong
49 #define _PyBytes_FormatLong _PyString_FormatLong
49 #define PyBytes_DecodeEscape PyString_DecodeEscape
50 #define PyBytes_DecodeEscape PyString_DecodeEscape
50 #define _PyBytes_Join _PyString_Join
51 #define _PyBytes_Join _PyString_Join
51 #define PyBytes_Decode PyString_Decode
52 #define PyBytes_Decode PyString_Decode
52 #define PyBytes_Encode PyString_Encode
53 #define PyBytes_Encode PyString_Encode
53 #define PyBytes_AsEncodedObject PyString_AsEncodedObject
54 #define PyBytes_AsEncodedObject PyString_AsEncodedObject
54 #define PyBytes_AsEncodedString PyString_AsEncodedString
55 #define PyBytes_AsEncodedString PyString_AsEncodedString
55 #define PyBytes_AsDecodedObject PyString_AsDecodedObject
56 #define PyBytes_AsDecodedObject PyString_AsDecodedObject
56 #define PyBytes_AsDecodedString PyString_AsDecodedString
57 #define PyBytes_AsDecodedString PyString_AsDecodedString
57 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
58 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
58 #define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping
59 #define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping
59
60
60 #endif /* PY_VERSION_HEX */
61 #endif /* PY_VERSION_HEX */
61
62
62 #endif /* _HG_UTIL_H_ */
63 #endif /* _HG_UTIL_H_ */
63
64
General Comments 0
You need to be logged in to leave comments. Login now