mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-23 09:23:43 +03:00
Fixed 2-phase commit support in Python 3.
This commit is contained in:
parent
89fb60de4b
commit
96a950d3eb
|
@ -1050,7 +1050,7 @@ conn_tpc_command(connectionObject *self, const char *cmd, XidObject *xid)
|
||||||
Dprintf("conn_tpc_command: %s", cmd);
|
Dprintf("conn_tpc_command: %s", cmd);
|
||||||
|
|
||||||
/* convert the xid into PostgreSQL transaction id while keeping the GIL */
|
/* 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; }
|
if (!(ctid = Bytes_AsString(tid))) { goto exit; }
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
|
|
@ -399,7 +399,11 @@ _xid_base64_enc_dec(const char *funcname, PyObject *s)
|
||||||
|
|
||||||
if (!(base64 = PyImport_ImportModule("base64"))) { goto exit; }
|
if (!(base64 = PyImport_ImportModule("base64"))) { goto exit; }
|
||||||
if (!(func = PyObject_GetAttrString(base64, funcname))) { 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:
|
exit:
|
||||||
Py_XDECREF(func);
|
Py_XDECREF(func);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user