summaryrefslogtreecommitdiff
path: root/MySQLdb
diff options
context:
space:
mode:
authoradustman <adustman@9fc6cd9a-920d-0410-adcf-ac96716ed7e8>2012-09-07 22:48:55 +0000
committeradustman <adustman@9fc6cd9a-920d-0410-adcf-ac96716ed7e8>2012-09-07 22:48:55 +0000
commitc1d15552e6f841c080942c211271df9333127b9c (patch)
tree3e7367371ee35ee4d2caa0f93a59ce58a4a9df73 /MySQLdb
parent66abb0e8d09ebca685c2e0f91b5ed16019bdd990 (diff)
downloadmysqldb1-c1d15552e6f841c080942c211271df9333127b9c.tar.gz
A couple more Python 3 fixes.
Diffstat (limited to 'MySQLdb')
-rw-r--r--MySQLdb/_mysql.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c
index e79303b..0b18f31 100644
--- a/MySQLdb/_mysql.c
+++ b/MySQLdb/_mysql.c
@@ -32,6 +32,7 @@ PERFORMANCE OF THIS SOFTWARE.
#define PyInt_FromLong(n) PyLong_FromLong(n)
#define PyInt_Check(n) PyLong_Check(n)
#define PyInt_AS_LONG(n) PyLong_AS_LONG(n)
+#define RO READONLY
#endif
#if PY_VERSION_HEX > 0x02060000
#include "bytesobject.h"
@@ -58,7 +59,11 @@ PERFORMANCE OF THIS SOFTWARE.
# define MyMember(a,b,c,d,e) {a,b,c,d,e}
# define MyMemberlist(x) struct PyMemberDef x
# define MyAlloc(s,t) (s *) t.tp_alloc(&t,0)
-# define MyFree(ob) ob->ob_type->tp_free((PyObject *)ob)
+#ifdef IS_PY3K
+# define MyFree(o) PyObject_Del(o)
+#else
+# define MyFree(ob) ob->ob_type->tp_free((PyObject *)ob)
+#endif
#endif
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
@@ -2235,7 +2240,11 @@ _mysql_ResultObject_repr(
char buf[300];
sprintf(buf, "<_mysql.result object at %lx>",
(long)self);
+#ifdef IS_PY3K
+ return PyUnicode_FromString(buf);
+#else
return PyString_FromString(buf);
+#endif
}
static PyMethodDef _mysql_ConnectionObject_methods[] = {