blob: 55bcfda453f39c4efedf69800810be97f62b44b1 [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
16#define PyBytes_FromStringAndSize PyString_FromStringAndSize
17
18#define PyLong_FromLong PyInt_FromLong
Jean-Paul Calderoneae479ad2010-08-10 20:04:28 -040019#define PyLong_Check(o) (PyInt_Check(o) || PyLong_Check(o))
Jean-Paul Calderoneef853eb2010-08-10 19:47:06 -040020
21#define PyBytes_Size PyString_Size
22#define PyBytes_Check PyString_Check
23#define PyBytes_AsString PyString_AsString
24#define PyBytes_FromStringAndSize PyString_FromStringAndSize
25
26#define PyText_FromString PyString_FromString
27
28#define PyOpenSSL_MODINIT(name)
29void \
30init##name(void)
31
32#endif /* (PY_VERSION_HEX >= 0x03000000) */
33
34#endif /* PyOpenSSL_PY3K_H_ */
35