Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c1d1555

Browse filesBrowse files
author
adustman
committed
A couple more Python 3 fixes.
1 parent 66abb0e commit c1d1555
Copy full SHA for c1d1555

File tree

Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed

‎MySQLdb/_mysql.c

Copy file name to clipboardExpand all lines: MySQLdb/_mysql.c
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PERFORMANCE OF THIS SOFTWARE.
3232
#define PyInt_FromLong(n) PyLong_FromLong(n)
3333
#define PyInt_Check(n) PyLong_Check(n)
3434
#define PyInt_AS_LONG(n) PyLong_AS_LONG(n)
35+
#define RO READONLY
3536
#endif
3637
#if PY_VERSION_HEX > 0x02060000
3738
#include "bytesobject.h"
@@ -58,7 +59,11 @@ PERFORMANCE OF THIS SOFTWARE.
5859
# define MyMember(a,b,c,d,e) {a,b,c,d,e}
5960
# define MyMemberlist(x) struct PyMemberDef x
6061
# define MyAlloc(s,t) (s *) t.tp_alloc(&t,0)
61-
# define MyFree(ob) ob->ob_type->tp_free((PyObject *)ob)
62+
#ifdef IS_PY3K
63+
# define MyFree(o) PyObject_Del(o)
64+
#else
65+
# define MyFree(ob) ob->ob_type->tp_free((PyObject *)ob)
66+
#endif
6267
#endif
6368

6469
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
@@ -2235,7 +2240,11 @@ _mysql_ResultObject_repr(
22352240
char buf[300];
22362241
sprintf(buf, "<_mysql.result object at %lx>",
22372242
(long)self);
2243+
#ifdef IS_PY3K
2244+
return PyUnicode_FromString(buf);
2245+
#else
22382246
return PyString_FromString(buf);
2247+
#endif
22392248
}
22402249

22412250
static PyMethodDef _mysql_ConnectionObject_methods[] = {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.