Initial import to Tizen
[profile/ivi/python-pyOpenSSL.git] / OpenSSL / py3k.h
1 #ifndef PyOpenSSL_PY3K_H_
2 #define PyOpenSSL_PY3K_H_
3
4 #if (PY_VERSION_HEX >= 0x03000000)
5
6 #define PY3
7
8 #define PyOpenSSL_MODINIT(name) \
9 PyMODINIT_FUNC \
10 PyInit_##name(void)
11
12 #define PyText_CheckExact PyUnicode_CheckExact
13 #define PyText_FromString PyUnicode_FromString
14 #define PyText_FromStringAndSize PyUnicode_FromStringAndSize
15
16 #define PyOpenSSL_HEAD_INIT(type, size) PyVarObject_HEAD_INIT(NULL, size)
17
18 #define PyOpenSSL_Integer_Check(o) PyLong_Check(o)
19
20 #define PyOpenSSL_MODRETURN(module) { return module; }
21
22 #define BYTESTRING_FMT "y"
23
24 #else /* (PY_VERSION_HEX >= 0x03000000) */
25
26 #define PyOpenSSL_MODRETURN(module) { return; }
27
28 #define PyOpenSSL_HEAD_INIT(type, size) PyObject_HEAD_INIT(NULL) 0,
29
30 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
31
32 #define PyOpenSSL_Integer_Check(o) (PyInt_Check(o) || PyLong_Check(o))
33
34 #define PyBytes_Size PyString_Size
35 #define PyBytes_Check PyString_Check
36 #define PyBytes_CheckExact PyString_CheckExact
37 #define PyBytes_AsString PyString_AsString
38 #define PyBytes_FromString PyString_FromString
39 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
40 #define _PyBytes_Resize _PyString_Resize
41
42 #define PyText_CheckExact PyString_CheckExact
43 #define PyText_FromString PyString_FromString
44 #define PyText_FromStringAndSize PyString_FromStringAndSize
45
46 #define PyOpenSSL_MODINIT(name) \
47 void \
48 init##name(void)
49
50 #define BYTESTRING_FMT "s"
51
52 #endif /* (PY_VERSION_HEX >= 0x03000000) */
53
54 #endif /* PyOpenSSL_PY3K_H_ */
55