mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Fixed isready() not throwing exception on error
This commit is contained in:
parent
5480cf5332
commit
aeb5080208
|
@ -1,3 +1,8 @@
|
|||
2009-01-10 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* psycopg/cursor_type.c: cursor.isready() now raise an exception
|
||||
when the libpq PQconsumeInput() call fails.
|
||||
|
||||
2008-12-04 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* psycopg/lobject_type.c: fixed memory leak. The patch was kindly
|
||||
|
|
|
@ -1479,17 +1479,24 @@ psyco_curs_fileno(cursorObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
psyco_curs_isready(cursorObject *self, PyObject *args)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "")) return NULL;
|
||||
EXC_IF_CURS_CLOSED(self);
|
||||
|
||||
/* pq_is_busy does its own locking, we don't need anything special but if
|
||||
the cursor is ready we need to fetch the result and free the connection
|
||||
for the next query. */
|
||||
for the next query. if -1 is returned we raise an exception. */
|
||||
|
||||
if (pq_is_busy(self->conn)) {
|
||||
res = pq_is_busy(self->conn);
|
||||
|
||||
if (res == 1) {
|
||||
Py_INCREF(Py_False);
|
||||
return Py_False;
|
||||
}
|
||||
else if (res == -1) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
IFCLEARPGRES(self->pgres);
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
|
|
|
@ -137,11 +137,11 @@
|
|||
<File name="tests/test_dates.py" subtype="Code" buildaction="Nothing" />
|
||||
<File name="tests/test_lobject.py" subtype="Code" buildaction="Nothing" />
|
||||
<File name="tests/test_quote.py" subtype="Code" buildaction="Nothing" />
|
||||
<File name="psycopg/cursor_type.c.~1~" subtype="Code" buildaction="Nothing" />
|
||||
<File name="psycopg/lobject.h" subtype="Code" buildaction="Nothing" />
|
||||
<File name="psycopg/lobject_int.c" subtype="Code" buildaction="Compile" />
|
||||
<File name="psycopg/lobject_type.c" subtype="Code" buildaction="Compile" />
|
||||
<File name="psycopg/typecast_basic.c.old" subtype="Code" buildaction="Nothing" />
|
||||
<File name="sandbox/test_isready_connection_closed.py" subtype="Code" buildaction="Nothing" />
|
||||
</Contents>
|
||||
<compiler ctype="GccCompiler" />
|
||||
<MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user