Fixed 2-phase commit support in Python 3.

This commit is contained in:
Daniele Varrazzo 2010-12-30 01:30:09 +01:00
parent 89fb60de4b
commit 96a950d3eb
2 changed files with 6 additions and 2 deletions

View File

@ -1050,7 +1050,7 @@ conn_tpc_command(connectionObject *self, const char *cmd, XidObject *xid)
Dprintf("conn_tpc_command: %s", cmd);
/* convert the xid into PostgreSQL transaction id while keeping the GIL */
if (!(tid = xid_get_tid(xid))) { goto exit; }
if (!(tid = psycopg_ensure_bytes(xid_get_tid(xid)))) { goto exit; }
if (!(ctid = Bytes_AsString(tid))) { goto exit; }
Py_BEGIN_ALLOW_THREADS;

View File

@ -399,7 +399,11 @@ _xid_base64_enc_dec(const char *funcname, PyObject *s)
if (!(base64 = PyImport_ImportModule("base64"))) { goto exit; }
if (!(func = PyObject_GetAttrString(base64, funcname))) { goto exit; }
rv = PyObject_CallFunctionObjArgs(func, s, NULL);
Py_INCREF(s);
if (!(s = psycopg_ensure_bytes(s))) { goto exit; }
rv = psycopg_ensure_text(PyObject_CallFunctionObjArgs(func, s, NULL));
Py_DECREF(s);
exit:
Py_XDECREF(func);