summaryrefslogtreecommitdiff
path: root/psycopg
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-03 19:14:40 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-03 19:18:50 +0100
commitb276e3b05dee01396d7703cced6e3b75e05caec3 (patch)
tree30173af59655ee66ea51f119a9485f40339f2721 /psycopg
parent9eae66e8cf427484b9770f659a993389291b3b07 (diff)
downloadpsycopg2-b276e3b05dee01396d7703cced6e3b75e05caec3.tar.gz
Fixed compiling on Python versions before 2.6
Added a few macros not defined in Py 2.4. Don't know about 2.5.
Diffstat (limited to 'psycopg')
-rw-r--r--psycopg/bytes_format.c4
-rw-r--r--psycopg/python.h5
-rw-r--r--psycopg/typecast.c2
3 files changed, 10 insertions, 1 deletions
diff --git a/psycopg/bytes_format.c b/psycopg/bytes_format.c
index 3c64f4a..6d12d6c 100644
--- a/psycopg/bytes_format.c
+++ b/psycopg/bytes_format.c
@@ -80,6 +80,10 @@
#define PSYCOPG_MODULE
#include "psycopg/psycopg.h"
+#ifndef Py_LOCAL_INLINE
+#define Py_LOCAL_INLINE(type) static type
+#endif
+
/* Helpers for formatstring */
Py_LOCAL_INLINE(PyObject *)
diff --git a/psycopg/python.h b/psycopg/python.h
index 25dbd31..c3f9a0d 100644
--- a/psycopg/python.h
+++ b/psycopg/python.h
@@ -62,6 +62,11 @@
#define PyVarObject_HEAD_INIT(x,n) PyObject_HEAD_INIT(x) n,
#endif
+/* Missing at least in Python 2.4 */
+#ifndef Py_MEMCPY
+#define Py_MEMCPY memcpy
+#endif
+
/* FORMAT_CODE_PY_SSIZE_T is for Py_ssize_t: */
#define FORMAT_CODE_PY_SSIZE_T "%" PY_FORMAT_SIZE_T "d"
diff --git a/psycopg/typecast.c b/psycopg/typecast.c
index c321609..484ce45 100644
--- a/psycopg/typecast.c
+++ b/psycopg/typecast.c
@@ -438,7 +438,7 @@ typecast_repr(PyObject *self)
}
rv = PyString_FromFormat("<%s '%s' at %p>",
- Py_TYPE(self)->tp_name, PyBytes_AS_STRING(name), self);
+ Py_TYPE(self)->tp_name, Bytes_AS_STRING(name), self);
Py_DECREF(name);
return rv;