summaryrefslogtreecommitdiff
path: root/psycopg/python.h
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-12-31 02:49:46 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-12-31 03:22:19 +0100
commitac258169622ca758757e51338443a4cbed1e605d (patch)
treec917b0ea9ee1208aa4d669cdaad10739dec92ca0 /psycopg/python.h
parent2930ed3d594ec3652d5bd13cb7d8169541db807c (diff)
downloadpsycopg2-ac258169622ca758757e51338443a4cbed1e605d.tar.gz
Use the same Bytes_Format function for both Python 2 and 3.
This makes the behaviour between the two versions similar. It also have the effect of a more specific error message in case an user specifies a placeholder different from 's'.
Diffstat (limited to 'psycopg/python.h')
-rw-r--r--psycopg/python.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/psycopg/python.h b/psycopg/python.h
index ee2dee7..1e46cc5 100644
--- a/psycopg/python.h
+++ b/psycopg/python.h
@@ -103,8 +103,7 @@
#endif /* PY_MAJOR_VERSION > 2 */
#if PY_MAJOR_VERSION < 3
-/* XXX BytesType -> Bytes_Type */
-#define BytesType PyString_Type
+#define Bytes_Type PyString_Type
#define Bytes_Check PyString_Check
#define Bytes_CheckExact PyString_CheckExact
#define Bytes_AS_STRING PyString_AS_STRING
@@ -115,11 +114,11 @@
#define Bytes_FromString PyString_FromString
#define Bytes_FromStringAndSize PyString_FromStringAndSize
#define Bytes_FromFormat PyString_FromFormat
-#define Bytes_Format PyString_Format
+#define _Bytes_Resize _PyString_Resize
#else
-#define BytesType PyBytes_Type
+#define Bytes_Type PyBytes_Type
#define Bytes_Check PyBytes_Check
#define Bytes_CheckExact PyBytes_CheckExact
#define Bytes_AS_STRING PyBytes_AS_STRING
@@ -130,12 +129,12 @@
#define Bytes_FromString PyBytes_FromString
#define Bytes_FromStringAndSize PyBytes_FromStringAndSize
#define Bytes_FromFormat PyBytes_FromFormat
-#define Bytes_Format PyBytes_Format
-
-HIDDEN PyObject *PyBytes_Format(PyObject *format, PyObject *args);
+#define _Bytes_Resize _PyBytes_Resize
#endif
+HIDDEN PyObject *Bytes_Format(PyObject *format, PyObject *args);
+
/* Mangle the module name into the name of the module init function */
#if PY_MAJOR_VERSION > 2
#define INIT_MODULE(m) PyInit_ ## m