diff options
author | farcepest <farcepest@gmail.com> | 2012-10-17 18:30:19 -0400 |
---|---|---|
committer | farcepest <farcepest@gmail.com> | 2012-10-17 18:30:19 -0400 |
commit | 369810dff7d2e9d7371776f9dc58cedf5b794567 (patch) | |
tree | ce854a998ea449cef7acb900d83d3c0f6935b892 /_mysql.c | |
parent | c9b282f8b5f7595e7dc3c92b8964a423ba0fabdb (diff) | |
download | mysqldb1-369810dff7d2e9d7371776f9dc58cedf5b794567.tar.gz |
PyPy fixes, and probably some reference issues for CPython too.
Derived from a patch at https://bitbucket.org/pypy/compatibility/wiki/edit/mysql-python
Diffstat (limited to '_mysql.c')
-rw-r--r-- | _mysql.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -481,6 +481,7 @@ _mysql_ResultObject_Initialize( PyObject *pmask=NULL; pmask = PyTuple_GET_ITEM(t, 0); fun2 = PyTuple_GET_ITEM(t, 1); + Py_XINCREF(fun2); if (PyInt_Check(pmask)) { mask = PyInt_AS_LONG(pmask); flags = fields[i].flags; @@ -501,8 +502,10 @@ _mysql_ResultObject_Initialize( } Py_DECREF(t); } - if (!fun2) fun2 = Py_None; - Py_INCREF(fun2); + if (!fun2) { + fun2 = Py_None; + Py_INCREF(fun2); + } Py_DECREF(fun); fun = fun2; } @@ -1190,7 +1193,9 @@ _escape_item( "no default type converter defined"); goto error; } + Py_INCREF(d); quoted = PyObject_CallFunction(itemconv, "OO", item, d); + Py_DECREF(d); Py_DECREF(itemconv); error: return quoted; @@ -2985,6 +2990,9 @@ _mysql_NewException( if (!(e = PyDict_GetItemString(edict, name))) return NULL; if (PyDict_SetItemString(dict, name, e)) return NULL; +#ifdef PYPY_VERSION + Py_INCREF(e); +#endif return e; } |