Commit Graph

650 Commits

Author SHA1 Message Date
Daniele Varrazzo
f6054c28d8 Release the GIL around PQgetResult calls after COPY
It should fix ticket #140.
2012-11-24 22:51:23 +00:00
Daniele Varrazzo
4ddad45feb Discard any result produced by cursor.executemany() 2012-10-11 22:27:35 +01:00
Daniele Varrazzo
58d048198f Close the connection on error in callback
Unfortunately PQcancel blocks, so it's not better than PQgetResult.
It has been suggested to use PQreset in non-blocking way but this would give
the Python program the burden of handling a connection done but not configured
in an unexpected place.
2012-10-09 02:01:29 +01:00
Daniele Varrazzo
7632e1ae46 Get the result from the connection after the green panic
Otherwise the connection won't be usable in case we manage
to put it back on track (libpq reports "another command is
already in progress")
2012-10-09 02:01:29 +01:00
Daniele Varrazzo
6b6aded90b Added compatibility PyErr_WarnEx macro for Python 2.4 2012-10-09 02:01:29 +01:00
Daniele Varrazzo
fa032f09fb Attempt to fix issue #113.
If the network is down, trying to read blocking will hang the process hard
(ctrl-c not working). Send a cancel signal instead (as suggested in
http://archives.postgresql.org/pgsql-hackers/2012-07/msg00903.php) and go
back into a green polling: this should allow a further error (e.g. another
ctrl-c) to break the loop. In this case we cannot assume anything about
the state of the connection, so we close it.
2012-10-09 02:01:29 +01:00
Daniele Varrazzo
6d1b3b21e6 Added function conn_close_locked() 2012-10-09 02:01:29 +01:00
Daniele Varrazzo
f4f67ad985 Dropped compiler warning on Py 2.4 2012-10-06 01:22:05 +01:00
Daniele Varrazzo
c7bee92160 Fixed infinite loop when parsing '{' as array 2012-09-20 03:19:24 +01:00
Daniele Varrazzo
72e9cf7b6d Fixed return value after malformed arrays 2012-09-10 04:20:39 +01:00
Federico Di Gregorio
64674787fd Fixed always true comparaison 2012-08-17 14:52:59 +02:00
Daniele Varrazzo
cc951b5fbe Fixed tpc_recover() with RealDictStuff
Same problem and correction of ticket #114.
2012-08-14 23:29:19 +01:00
Daniele Varrazzo
c7d1271ab4 Fixed cursor name as unicode string on Python 3 2012-05-27 08:58:55 +01:00
Daniele Varrazzo
874a74fe94 Dropped GIL release around function calling PyMem_Malloc
Closes ticket #110.
2012-05-22 17:22:57 +01:00
Daniele Varrazzo
27421f1e41 Name can be passed as None to cursor()
Makes invocation from subclasses and generic code easier.

Code simplified by using default values for keyword arguments
and avoiding needless conversions back and forth between Python and C
strings. Also added connection type check to cursor's init.
2012-04-11 17:32:10 +01:00
Daniele Varrazzo
c63891af8d Fixed bad error return code from cursor's init 2012-04-11 17:26:11 +01:00
Federico Di Gregorio
550130b19e Merge remote-tracking branch 'piro/devel' into devel
Conflicts:
	psycopg/lobject_int.c
2012-03-08 12:28:52 +01:00
Daniele Varrazzo
b8c75d9de0 Merge branch 'gcc-python-plugin' into devel 2012-03-05 02:48:11 +00:00
Daniele Varrazzo
37aa62ca52 Merge branch 'close-idempotent' into devel 2012-03-05 02:47:52 +00:00
Daniele Varrazzo
8707d8c399 Fixed iterator refcount in case of memory error during COPY 2012-03-05 02:09:20 +00:00
Daniele Varrazzo
735d50c782 Check if the object wrapped in binary is not None before trying the other types
Otherwise it seems we clobber some result with NULL.
2012-03-05 02:08:45 +00:00
Daniele Varrazzo
a9dc1b83ad Methods callbacks signatures match the flags they are exported with 2012-03-05 01:26:28 +00:00
Daniele Varrazzo
531084d561 Stricter types usage in several PyArg_ParseTuple calls 2012-03-04 18:01:08 +00:00
Daniele Varrazzo
0e832b97ea Proper type check in prepare() methods for list, binary, qstring 2012-03-04 17:59:51 +00:00
Daniele Varrazzo
84f2a370f6 close() methods don't raise errors if called on closed objects 2012-03-04 05:10:07 +00:00
Daniele Varrazzo
76cc838a93 Expressions rewritten in a more normal way
(double)'0'? :)
2012-03-04 04:47:21 +00:00
Daniele Varrazzo
5bbfd38dfb Check for errors in float adaptation 2012-03-04 04:43:14 +00:00
Daniele Varrazzo
6cece00958 Check failed list creation in array adaptation 2012-03-04 04:42:44 +00:00
Daniele Varrazzo
be35df3818 Fixed typecasters refcount 2012-03-04 04:41:36 +00:00
Daniele Varrazzo
dc4c3d3143 Guard from failed keys creation during adaptation 2012-03-04 04:40:44 +00:00
Daniele Varrazzo
18085201c8 Guard from NULL dereference if Xid allocation fails 2012-03-04 04:39:41 +00:00
Daniele Varrazzo
31812c01e6 Further modeling of exception raising 2012-03-04 04:38:44 +00:00
Daniele Varrazzo
d93732558d Raise an exception in case of failed localtime_r call 2012-03-04 04:17:03 +00:00
Daniele Varrazzo
4d15b973b0 Attempt to enforce signature for the "O&" converter functions
It seems causing a traceback in the static checker. Enforcing it simplifies
the code, but doesn't help the checker.
2012-03-01 02:53:29 +00:00
Daniele Varrazzo
e1266d52cd More functions annotated for static analysis
Also more return values checked for values < 0 for errors, instead of
checking == 0 and leaving the positive side unchecked
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
5bfb6cdefe Use more compact macros to annotate functions for the static checker 2012-03-01 02:53:28 +00:00
Daniele Varrazzo
f2e4a8ed78 Functions setting exception return a negative value on error
This works around another shortcoming of the static checker; also to be
discussed with the author.
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
9432787279 Work around a false positive returned by the static checker
To be submitted to the author.
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
a167822e26 Use the newly provided attributes to validate exceptions raising
Be more consistent in using 0 for success, <0 for failure, and to check
for values < 0 instead of specific -1.
2012-03-01 02:53:28 +00:00
Marti Raudsepp
b97599166e Update all links to PostgreSQL docs to the current version.
I also checked all links and anchors to make sure they're still valid.
2012-02-28 18:28:07 +02:00
Daniele Varrazzo
67712e4226 Fixed possible NULL dereferencing in fetchmany()/fetchall() 2012-02-24 22:26:02 +00:00
Daniele Varrazzo
6d76e81166 Fixed possible NULL dereferencing in callproc() 2012-02-24 22:26:02 +00:00
Daniele Varrazzo
94a53b48df Building rows simplified
Dropped repeated checks for tuple_factory.
Internal functions refactored a bit.
2012-02-24 22:26:02 +00:00
Daniele Varrazzo
efee049338 Added error check in _mogrify for failed tuple creation 2012-02-24 22:26:02 +00:00
Daniele Varrazzo
0ee641361b Flag a few other functions returning borrowed refs 2012-02-24 22:26:01 +00:00
Daniele Varrazzo
4ecfd48671 Fixed possible NULL dereferencing in notice process 2012-02-24 22:25:56 +00:00
Daniele Varrazzo
a6df55f4e3 Flag the psycopg_ensure_*() functions as stealing a ref 2012-02-24 10:41:02 +00:00
Daniele Varrazzo
5f3f35a2c2 Mark getnextarg function as returning a borrowed reference 2012-02-24 04:25:08 +00:00
Daniele Varrazzo
fc78fb09c0 Dropped unused pq_resolve_critical() return value 2012-02-24 04:00:12 +00:00
Daniele Varrazzo
4eea8bc912 Dropped redundant check on the status before rollback
The check is better done inside the critical section.
2012-02-24 03:28:20 +00:00