Fix the 2.x version of certain things; introduce MODRETURN
diff --git a/OpenSSL/py3k.h b/OpenSSL/py3k.h
index e267af1..4e7cff4 100644
--- a/OpenSSL/py3k.h
+++ b/OpenSSL/py3k.h
@@ -5,22 +5,28 @@
#define PY3
-#define PyOpenSSL_MODINIT(name) \
+#define PyOpenSSL_MODINIT(name) \
PyMODINIT_FUNC \
PyInit_##name(void)
#define PyText_FromString PyUnicode_FromString
#define PyText_FromStringAndSize PyUnicode_FromStringAndSize
+#define PyOpenSSL_HEAD_INIT(type, size) PyVarObject_HEAD_INIT(type, size)
+
+#define PyOpenSSL_Integer_Check(o) PyLong_Check(o)
+
+#define PyOpenSSL_MODRETURN(module) { return module; }
+
#else /* (PY_VERSION_HEX >= 0x03000000) */
-#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(NULL) 0
+#define PyOpenSSL_MODRETURN(module) { return; }
+
+#define PyOpenSSL_HEAD_INIT(type, size) PyObject_HEAD_INIT(NULL) 0,
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
-#define PyLong_FromLong PyInt_FromLong
-#define PyLong_AsLong PyInt_AsLong
-#define PyLong_Check(o) (PyInt_Check(o) || PyLong_Check(o))
+#define PyOpenSSL_Integer_Check(o) (PyInt_Check(o) || PyLong_Check(o))
#define PyBytes_Size PyString_Size
#define PyBytes_Check PyString_Check
@@ -31,7 +37,7 @@
#define PyText_FromString PyString_FromString
#define PyText_FromStringAndSize PyString_FromStringAndSize
-#define PyOpenSSL_MODINIT(name)
+#define PyOpenSSL_MODINIT(name) \
void \
init##name(void)