summaryrefslogtreecommitdiff
path: root/OpenSSL/py3k.h
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@divmod.com>2010-08-10 19:47:06 -0400
committerJean-Paul Calderone <exarkun@divmod.com>2010-08-10 19:47:06 -0400
commitef853ebb5f344a2395d8ddce287b9e543d73de21 (patch)
tree451e98201bb57bd868849fb4f41a22cf60da9f49 /OpenSSL/py3k.h
parente0d7936c734647a78502474553aa41c55fbd79dc (diff)
downloadpyopenssl-ef853ebb5f344a2395d8ddce287b9e543d73de21.tar.gz
Start porting the C to the Python 3 APIs
Diffstat (limited to 'OpenSSL/py3k.h')
-rw-r--r--OpenSSL/py3k.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/OpenSSL/py3k.h b/OpenSSL/py3k.h
new file mode 100644
index 0000000..a9e8e5c
--- /dev/null
+++ b/OpenSSL/py3k.h
@@ -0,0 +1,34 @@
+#ifndef PyOpenSSL_PY3K_H_
+#define PyOpenSSL_PY3K_H_
+
+#if (PY_VERSION_HEX >= 0x03000000)
+
+#define PY3
+
+#define PyOpenSSL_MODINIT(name) \
+PyMODINIT_FUNC \
+PyInit_##name(void)
+
+#define PyText_FromString PyUnicode_FromString
+
+#else /* (PY_VERSION_HEX >= 0x03000000) */
+
+#define PyBytes_FromStringAndSize PyString_FromStringAndSize
+
+#define PyLong_FromLong PyInt_FromLong
+
+#define PyBytes_Size PyString_Size
+#define PyBytes_Check PyString_Check
+#define PyBytes_AsString PyString_AsString
+#define PyBytes_FromStringAndSize PyString_FromStringAndSize
+
+#define PyText_FromString PyString_FromString
+
+#define PyOpenSSL_MODINIT(name)
+void \
+init##name(void)
+
+#endif /* (PY_VERSION_HEX >= 0x03000000) */
+
+#endif /* PyOpenSSL_PY3K_H_ */
+