Commit Graph

1490 Commits

Author SHA1 Message Date
Daniele Varrazzo
0e06addc9f Testing boilerplate unified in a single base class
The class makes a connection always available, allows creating
new connection and closes everything on tear down.
2013-04-07 00:23:30 +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
546927d44a Use wrap to fix names of decorated test methods
Decorators not using wrap() prevent running the test from command line, e.g.
with:

    python tests/__init__.py test_module.TestSuite.test_method
2013-03-20 23:53:20 +00:00
Daniele Varrazzo
31265e3439 Fixed broken test decorator preventing 3 tests to run 2013-03-20 23:53:19 +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
09629a6dbc Use wrap to fix names of decorated test methods
Decorators not using wrap() prevent running the test from command line, e.g.
with:

    python tests/__init__.py test_module.TestSuite.test_method
2013-03-20 17:26:10 +00:00
Daniele Varrazzo
0c0e2a2455 Fixed broken test decorator preventing 3 tests to run 2013-03-20 17:13:33 +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
Daniele Varrazzo
75811f5bb1 Note than Python 3.3 is supported in install docs 2013-03-20 13:08:01 +00:00
Daniele Varrazzo
87962728ee Fixed ticket number in NEWS file 2013-03-20 11:42:15 +00:00
Daniele Varrazzo
5dfba462da Dropped "customized" pg_free functions
The defaut is already to call PyObject_GC_Del.
2013-03-20 01:48:21 +00:00
Daniele Varrazzo
0830deb790 Dropped IFCLEARPGRES macro
PQclear already guards against NULL, so the extra check is redundant
2013-03-20 01:48:17 +00:00
Daniele Varrazzo
16021dae6d Use Py_CLEAR on self->query instead of if and decref 2013-03-20 01:48:11 +00:00
Daniele Varrazzo
a210859326 Notify and Xid objects and types renamed for consistency
They were the only objects starting with uppercase. My fault.
2013-03-20 01:48:05 +00:00
Daniele Varrazzo
73949cd1b8 Merge branch 'diagnostics' into devel 2013-03-20 01:47:14 +00:00
Daniele Varrazzo
b503db9ce6 psycopg2.Error object and type renamed more consistently 2013-03-20 00:03:58 +00:00
Daniele Varrazzo
114c62fac8 Added tests to verify the new Diagnostics properties
diag can be used on exceptions raised without cursor and is independent from
the cursor.

Docs updated to reflect the changes.
2013-03-20 00:03:58 +00:00
Daniele Varrazzo
7177f815a6 Store a PGresult in the Exception error
This makes the Diagnostics independent from further operations on the cursor
and allows using it with exceptions not generated by a cursor.
2013-03-19 23:42:54 +00:00
Daniele Varrazzo
394312939e Added a C structure to psycopg.Error
This will allow to store a PGresult in it.
2013-03-19 12:15:49 +00:00
Daniele Varrazzo
e86efa7e30 Added summary data types conversion table to the docs
It allows looking at a glance both basic and extended type casters,
with plenty of links to the detailed explanations.
2013-03-18 19:22:31 +00:00
Daniele Varrazzo
abb3027aa3 NEWS file reformatted to reST and included in the docs 2013-03-18 15:42:10 +00:00
Daniele Varrazzo
93928a7141 Document that errorcodes is updated to 9.2 2013-03-18 15:10:24 +00:00
Daniele Varrazzo
ae918c34b8 Copyright year bumped to 2013 in docs footer 2013-03-18 15:10:06 +00:00
Daniele Varrazzo
294e7ae080 Tests tweaked to run on all the supported versions 2013-03-18 10:06:07 +00:00
Daniele Varrazzo
97311967e8 Merge branch 'diagnostics' into devel 2013-03-18 02:21:09 +00:00
Daniele Varrazzo
fe6eb127fc Fixed bad interaction of setup.py with other dependencies
The problem is in Distribute dependencies on Python 3. Create a new command
class instead of changing inplace the one other projects may use.

Close ticket #153.
2013-03-18 02:18:50 +00:00
Daniele Varrazzo
49c3569919 Diagnostics added to the NEWS file 2013-03-18 02:11:45 +00:00
Daniele Varrazzo
1cf9825035 Diagnostics is more GC friendly 2013-03-18 02:11:45 +00:00
Daniele Varrazzo
678f0dc949 Added documentation about the Diagnostics object 2013-03-18 02:11:45 +00:00
Daniele Varrazzo
819a551d01 Decode Diagnostics result on Python 3 2013-03-18 00:38:28 +00:00
Daniele Varrazzo
70b756b8c7 Added test to verify Diagnostics works after copy errors 2013-03-18 00:31:25 +00:00
Daniele Varrazzo
660386929f Added test to verify Diagnostics reference disposal 2013-03-18 00:24:46 +00:00