Daniele Varrazzo
3b7f57b6d8
Parse the rowcount as long
2014-05-13 14:18:46 +01:00
Daniele Varrazzo
e9335b08f8
Copy operations correctly set the cursor.rowcount attribute
...
Fixes ticket #180 .
2014-05-05 23:52:41 +01:00
Daniele Varrazzo
5a660b80f5
Fixed explicit connection.cursor(cursor_factory=None)
...
Fixes issue #210 .
2014-04-30 17:56:09 +01:00
Daniele Varrazzo
e3ecae75a0
Merge branch 'connection-closed' into maint_2_5
...
NEWS for released 2.5.3 reordered.
2014-04-05 16:10:32 +01:00
Daniele Varrazzo
12c2fafa86
Close the connection if discovered bad on poll()
2014-04-05 15:52:41 +01:00
Daniele Varrazzo
e5ab0b3987
Check the connection is really bad on exception before closing it
...
We end up here without a pgres sometimes (e.g. from lobject errors)
2014-04-05 15:51:39 +01:00
Daniele Varrazzo
f0c38f0b37
Fixed attempt of closing an already closed lobject on dealloc
...
This results in a "null without exception set" in the corrent state, which
is caused by the connection being unexpectedly closed anyway.
2014-04-05 15:51:33 +01:00
Daniele Varrazzo
221d0d66de
Don't set an exception witout GIL closing lobjects with a bad conn
...
We ended up in this branch only for an excessively aggressive closing
of the transaction that now I'm going to fix.
2014-04-05 15:51:25 +01:00
Daniele Varrazzo
a201307185
Avoid printing the typecast name in debug statement
...
The way we were doing it is unsafe and causes assertion failures on Py3.
Fixes ticket #188
2014-04-04 19:26:35 +01:00
Daniele Varrazzo
cefef286a6
Fixed use of Python object with refcount 0 in cursor_init
...
Caused segfault running test_cursor.CursorTests.test_invalid_name under
Python 3.4 built in debug mode.
2014-04-04 19:26:34 +01:00
Daniele Varrazzo
2245b56dc1
Fixed overflow opening a lobject with an oid not fitting in a signed int
...
Fixes 🎫 `203`.
2014-04-03 02:35:46 +01:00
Daniele Varrazzo
65fbe9159a
Fixed dsn and closed attributes in failing connection subclasses.
...
From ticket #192 discussion.
2014-04-03 01:41:19 +01:00
Daniele Varrazzo
d1e1243ba8
Close a connection if PQexec returned NULL
...
This happens for Socket connections, not for TCP ones, where a result
containing an error is returned and correctly handled by pq_raise()
Closes ticket #196 but not #192 : poll() still doesn't change the
connection closed.
2014-03-06 18:17:32 +00:00
Daniele Varrazzo
f597c36f42
Allow get_transaction_status on closed connections
...
It's a local operation and the libpq functions has a NULL guard.
2014-03-06 18:02:08 +00:00
Daniele Varrazzo
d6da4ed09f
Don't segfault on uninitialized cursor
...
It can happen with bad cursor subclasses not calling super's init. Raise
an exception instead of segfaulting.
Closes #195
2014-02-26 19:42:29 +00:00
Daniele Varrazzo
69b2fa282c
Use the do-while 0 idiom for cursor guards macro
2014-02-26 19:42:28 +00:00
Daniele Varrazzo
98ea06d8b4
Set the connection async before polling for connection
...
It should fix ticket #194
2014-02-24 12:12:16 +00:00
Daniele Varrazzo
a8ef13620a
Set the connection async earlier in green mode
...
The moment it is called shouldn't have really changed, but it's more
explicit when it happens. Previously it was sort of obfuscated behind a
roundtrip through the green callback and poll.
2014-02-24 11:59:07 +00:00
Daniele Varrazzo
8aaa4eabca
Fixed dealloc of lobject->smode
...
I put it by mistake into the in the self->conn checked block in the
previous commit.
2013-11-27 12:59:14 +00:00
Daniele Varrazzo
7e9e11ee27
Check connection type in lobject init
...
Fixes ticket #187 .
2013-11-27 12:42:57 +00:00
Daniele Varrazzo
09cf64dda4
Meaningful connection errors report a meaningful message
...
Fixes issue #173 .
2013-10-16 15:28:16 +01:00
Daniele Varrazzo
0e08fbb20b
Fixed pickling of exceptions with no pgerror/pgcode set
...
Fixes ticket #170 .
2013-07-19 16:05:48 +01:00
Daniele Varrazzo
889b1d826e
Untrack the connection before closing to avoid possible double-free
...
From Gangadharan S.A. Fixes issue #166 .
2013-06-20 16:35:01 +01:00
Piotr Kasprzyk
5f320e52f4
Fix multiple misspellings
2013-04-26 10:32:21 +01:00
Daniele Varrazzo
35086c9ef0
Long ifdef reformatted for readibility
2013-04-21 18:43:08 +01:00
Daniel Enman
e93357ba17
Remove extra ||
2013-04-21 18:43:08 +01:00
Daniel Enman
ec4aa95554
Solaris 10+, and illumos distros have round()
2013-04-21 18:43:08 +01:00
Daniele Varrazzo
b214d10fff
Use NULL instead of an empty string as PyObject_CallMethod format
2013-04-07 17:26:57 +01:00
Daniele Varrazzo
9e15f54fe8
Added cursor_factory connection attribute and connect() parameter
2013-04-07 02:30:12 +01:00
Daniele Varrazzo
408c76fdb6
Fixed build on windows
...
Will fail with error: initializer element is not constant
2013-04-06 01:34:12 +01:00
Daniele Varrazzo
d36024dc1f
Use the Python heap for conn->dsn
2013-04-06 00:42:25 +01:00
Daniele Varrazzo
c63d623f65
Merge branch 'drop-py24' into devel
2013-04-05 01:29:25 +01:00
Daniele Varrazzo
beea32ef03
Use the Py_RETURN_NONE macro
2013-04-05 01:25:05 +01:00
Daniele Varrazzo
67c8250081
Added tp_clear method for objects with GC support
2013-04-05 01:05:12 +01:00
Daniele Varrazzo
1a93279fe7
Dropped bogus return in void function
2013-04-05 01:03:05 +01:00
Daniele Varrazzo
e14440d96d
Dropped GC support for several objects
...
Non-containers don't need GC. It was half-baked anyway
as the tp_clear was often not set. Dropped tp_traverse too
for these objects as unused.
2013-04-05 01:02:47 +01:00
Daniele Varrazzo
95ff64d739
Dropped encoding attribute from list adapter
2013-04-05 00:35:02 +01:00
Daniele Varrazzo
6bc4b23af5
Static-type psycopg_escape_string connection parameter
2013-04-05 00:07:36 +01:00
Daniele Varrazzo
736a78f3f6
Avoid encoding strdup in qstring adapter
...
Dropped encoding parameter in the constructor: it is used
nowhere and not documented. Use directly the connection
encoding if available, else the previous latin1 fallback.
2013-04-05 00:00:42 +01:00
Daniele Varrazzo
7a5a226b49
Set a memory exception in psycopg_escape_string
...
...otherwise all the callers should set it.
2013-04-04 22:48:53 +01:00
Daniele Varrazzo
7328aaf0fb
Dropped GC support from Xid and Notify types
...
These types are immutable and have only atomic types attributes, so it's
impossible to build loops out of them.
2013-04-02 01:50:31 +01:00
Daniele Varrazzo
5aafe38fd7
Some improvements to connection/cursor GC
...
Provide a tp_clear, make sure that GC_UnTrack is called before clearing.
2013-03-21 12:55:17 +00:00
Daniele Varrazzo
3b8abf3fc4
Clean the C members of Error in tp_dealloc instead of tp_clear
...
tp_clear should only be used to break the reference cycles. tp_clear was
causing a segfault because it was called twice (by the gc and by _dealloc) so
self->codec was freed twice.
Amazingly the double free was only causing a segfault on Python 3.3 (released
in late 2012) talking to Postgres 8.1 (released in 2005) in async mode... no
other combination crashed. Thank you buildbot.
2013-03-21 12:34:53 +00:00
Daniele Varrazzo
d5316d7eb2
PyType_GenericAlloc is the default allocator: no need to specify
2013-03-20 23:53:20 +00:00
Daniele Varrazzo
eb280c1da4
Better use of Py_CLEAR and implicit zeroed-out structures
2013-03-20 23:53:20 +00:00
Daniele Varrazzo
b6873ee1ab
Dropped support for Python 2.4
2013-03-20 23:40:13 +00:00
Daniele Varrazzo
e65392e0d8
PyType_GenericAlloc is the default allocator: no need to specify
2013-03-20 22:59:50 +00:00
Daniele Varrazzo
8a59e75d62
Better use of Py_CLEAR and implicit zeroed-out structures
2013-03-20 22:59:50 +00:00
Daniele Varrazzo
3410fee8d1
Fixed leak of cancel key on connection.reset()
...
Moving the final free into the destructor is not necessary but looks
appropriate.
2013-03-20 16:43:16 +00:00
Daniele Varrazzo
9813bac4fe
Added forgotten attributes to visit in error
2013-03-20 15:06:06 +00:00