Commit Graph

964 Commits

Author SHA1 Message Date
Daniele Varrazzo
332acccc6e Replace b('str') with b'str' in Python 3
This avoids an encode() call for each of these constants.

Use a custom 2to3 fixer in setup.py to perform the conversion.
2011-01-13 11:37:40 +00:00
Daniele Varrazzo
3ba0631dbb A few large objects tests fixed
The behavior changed in Python 3 after the lobject-decode merge.
2011-01-10 22:05:47 +00:00
Daniele Varrazzo
36d9ffea32 Merge branch 'lobject-decode' into python3 2011-01-10 00:49:04 +00:00
Daniele Varrazzo
789dda1173 lobject read and write can deal with both bytes and unicode
On write, unicode is encoded in connection encoding.
On read, respect the lobject mode 't' or 'b'.
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
ba1d77a297 Large object mode parsing refactored
Added parsing of text/binary mode.
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
f63167a92c Added tests to check large objects decoding 2011-01-10 00:46:51 +00:00
Daniele Varrazzo
2cde9033ac Added documentation for Unicode support in large object
Not implemented yet!
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
79048ff19a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	tests/__init__.py
	tests/test_lobject.py
	tests/test_quote.py
	tests/testutils.py
2011-01-10 00:46:02 +00:00
Daniele Varrazzo
f345e7daeb Merge branch 'python32' into python3 2011-01-10 00:25:09 +00:00
Daniele Varrazzo
48588e5f69 Invalidate large objects after a two-phase commit operation 2011-01-10 00:20:55 +00:00
Daniele Varrazzo
935c25730a Fixed segfault in large object close.
Check that the connection is not closed/faulty before attempting lo_close.
2011-01-10 00:11:14 +00:00
Daniele Varrazzo
38641b93ea Test decorator moved into the test utilities module 2011-01-09 23:44:58 +00:00
Daniele Varrazzo
15a09da96d Added license to unit tests
As the test suite is now part of the source distribution.
2011-01-09 23:44:35 +00:00
Daniele Varrazzo
f8c4335f35 Avoid ResourceWarning in tests in Python 3.2 2011-01-08 23:54:48 +00:00
Daniele Varrazzo
43c8fce45c Silence warnings due to deprecated TestCase methods
With a veiled criticism.
2011-01-08 23:54:17 +00:00
Daniele Varrazzo
ac5cde8834 Only use absolute imports in the package
In Python 3.2b2 the relative imports are not converted into explicit
ones (with .).
2011-01-08 01:24:28 +00:00
Daniele Varrazzo
9deb16484d Don't define a CObject API in Python 3.2
The API is not available: a PyCapsule should be used. Nobody seems
needing it for now.
2011-01-08 01:24:16 +00:00
Daniele Varrazzo
7c1b03bd45 All tests made executable. 2011-01-07 00:58:29 +00:00
Daniele Varrazzo
b8c8cddc2d Fixed argument parsing in lobject.read
Using an int instead of a Py_ssize_t randomly crashed Python 3.1 64 bit.
2011-01-04 02:27:02 +01:00
Daniele Varrazzo
80bd6e2794 Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	psycopg/connection_type.c
	tests/test_connection.py
	tests/types_basic.py
2011-01-03 21:43:02 +01:00
Daniele Varrazzo
627df15995 Merge branch 'noleak' into python2 2011-01-03 21:39:35 +01:00
Daniele Varrazzo
8d44d0f1c7 Mention refcount fixes in NEWS files 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
abd7991968 Fixed refcount bug with connection destroyed in a 2PC transaction 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
5f6e773575 Broken circular reference in async execution
If a connection is destroyed before an async operation is completed, the
`async_cursor` member creates a reference loop, leaving the connection and
the cursor alive. `async_cursor` is now a weak reference.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
19ff51ae75 The cursor is weakly referenceable 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
04cf90cc21 The connection is weakly referenceable 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
5888b03608 Fixed "historical" reference leak in TimestampFromTicks
Added an internal function with C signature to avoid the creation of a
tuple to be later unpacked. When the tuple was decref'd, Python 2.4 64
bits regularly segfaulted; Python 2.5 less regularly; don't know about
other versions.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
8b0af283f6 Don't register the unicode typecaster globally during tests
It can invalidate the results in further runs in the same process.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
131c6a25e9 Unregister test adapters to keep a more precise references count 2011-01-03 21:34:46 +01:00
Daniele Varrazzo
a44441f5e5 Added script to look for refcounting bugs 2011-01-03 21:34:46 +01:00
Daniele Varrazzo
a01700d478 Fixed test suite execution as a script
Don't know why I changed the defaultTest argument into a function when I
converted the test suite into a package: that argument should be really
a string.
2011-01-03 20:45:03 +01:00
Daniele Varrazzo
39dd577c90 Use the proper printf placeholders to avoid warnings on 64 bit builds 2011-01-03 20:44:57 +01:00
Daniele Varrazzo
68305a0eb6 Fixed TYPE adaptation to basic tuples
Tuples and namedtuples have different constructors.
2011-01-03 19:27:26 +01:00
Daniele Varrazzo
b276e3b05d Fixed compiling on Python versions before 2.6
Added a few macros not defined in Py 2.4. Don't know about 2.5.
2011-01-03 19:18:50 +01:00
Daniele Varrazzo
9eae66e8cf Added Py3 compatibility macro for Py_TPFLAGS_HAVE_WEAKREFS 2011-01-03 16:56:26 +01:00
Daniele Varrazzo
929d62053a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	setup.py
2011-01-02 03:28:00 +01:00
Daniele Varrazzo
7e9be4c133 Added Python 3 trove classifier. 2011-01-02 03:26:31 +01:00
Daniele Varrazzo
3cc8719998 Added missing test to the test suite. 2011-01-02 03:00:44 +01:00
Daniele Varrazzo
17f69ba735 Fixed Makefile dependencies of the test suite. 2011-01-02 03:00:32 +01:00
Daniele Varrazzo
afb87bb10a Fixed "building" of purelib files with make.
Using build instead of build_py forced build_ext to run too, which may
fail to run as the option PG_CONFIG is not passed (or, worse, we may end
up building against the wrong pg_config).

Also touching the target file as make seems considering the source file
newer than the destination when the timestamp is the same (as it is
because the file is usually just copied).
2011-01-02 02:44:56 +01:00
Daniele Varrazzo
d08bfcbee5 Refuse to build if pg_config is not found.
I think half of the problems in OS X setup are due to setup going ahead
even when the pg_config is not found. We are now only building with PG
version that make the tool available.
2011-01-02 02:01:53 +01:00
Daniele Varrazzo
88bb8eda3e None/IN adaptation ported to Python 3. 2011-01-02 00:44:14 +01:00
Daniele Varrazzo
45c6dfb69d Merge branch 'adapt-type' into python2 2011-01-02 00:35:59 +01:00
Daniele Varrazzo
7ac0bdd661 Added PostgreSQL composite types typecaster to Python tuples. 2011-01-02 00:34:13 +01:00
Daniele Varrazzo
159cda3688 Added cursor.cast() method
The method exposes the typecasters lookup algorithm. Useful to create
recursive typecasters.
2011-01-01 22:55:10 +01:00
Daniele Varrazzo
3e94375cf7 Merge branch 'python2' into python3
Conflicts:
	ChangeLog
	NEWS-2.3
	lib/extensions.py
	psycopg/microprotocols.c
	setup.py
2011-01-01 17:14:54 +01:00
Daniele Varrazzo
f9be48d89e Merge branch 'none-in-composite' into python2 2011-01-01 17:09:37 +01:00
Daniele Varrazzo
fdfa2de1a1 Fixed adaptation of None in composite types (ticket #26).
Added an adapter for None: it is usually not invoked as adaptation to
NULL is a fast path in mogrify, but can be invoked by composite types.
Notice that composite types still have the option to fast-path None
(e.g. list adapter does).
2011-01-01 17:07:54 +01:00
Daniele Varrazzo
506ce93a5b Bump to the next dev version. 2011-01-01 12:55:41 +01:00
Daniele Varrazzo
30921b58a8 Dropped conversion from None to NULL in adapter.
It was an error as the string is not conform to the protocol. The error
is masked by the None fast path in _mogrify, but surfaces when adapting
a tuple contains a None.
2010-12-31 18:55:33 +01:00