blob: dc46b43ae209511bb607f9d81f64e09fe91d0c47 [file] [log] [blame]
Jean-Paul Calderoneef853eb2010-08-10 19:47:06 -04001#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) \
9PyMODINIT_FUNC \
10PyInit_##name(void)
11
12#define PyText_FromString PyUnicode_FromString
13
14#else /* (PY_VERSION_HEX >= 0x03000000) */
15
Jean-Paul Calderone4d0c3212010-08-10 22:57:42 -040016#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(NULL) 0
17
Jean-Paul Calderoneef853eb2010-08-10 19:47:06 -040018#define PyBytes_FromStringAndSize PyString_FromStringAndSize
19
20#define PyLong_FromLong PyInt_FromLong
Jean-Paul Calderoneae479ad2010-08-10 20:04:28 -040021#define PyLong_Check(o) (PyInt_Check(o) || PyLong_Check(o))
Jean-Paul Calderoneef853eb2010-08-10 19:47:06 -040022
23#define PyBytes_Size PyString_Size
24#define PyBytes_Check PyString_Check
25#define PyBytes_AsString PyString_AsString
26#define PyBytes_FromStringAndSize PyString_FromStringAndSize
27
28#define PyText_FromString PyString_FromString
29
30#define PyOpenSSL_MODINIT(name)
31void \
32init##name(void)
33
34#endif /* (PY_VERSION_HEX >= 0x03000000) */
35
36#endif /* PyOpenSSL_PY3K_H_ */
37