summaryrefslogtreecommitdiff
path: root/psycopg/python.h
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/python.h')
-rw-r--r--psycopg/python.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/psycopg/python.h b/psycopg/python.h
index 521c568..f45aeb5 100644
--- a/psycopg/python.h
+++ b/psycopg/python.h
@@ -91,6 +91,11 @@ typedef unsigned long Py_uhash_t;
#define INIT_MODULE(m) init ## m
+/* fix #961, but don't change all types to longs. Sure someone will complain. */
+#define PyLong_FromOid(x) (((x) & 0x80000000) ? \
+ PyLong_FromUnsignedLong((unsigned long)(x)) : \
+ PyInt_FromLong((x)))
+
#endif /* PY_2 */
#if PY_3
@@ -133,6 +138,11 @@ typedef unsigned long Py_uhash_t;
#define INIT_MODULE(m) PyInit_ ## m
+#define PyLong_FromOid(x) (PyLong_FromUnsignedLong((unsigned long)(x)))
+
#endif /* PY_3 */
+/* expose Oid attributes in Python C objects */
+#define T_OID T_UINT
+
#endif /* !defined(PSYCOPG_PYTHON_H) */