Commit Graph

2933 Commits

Author SHA1 Message Date
Daniele Varrazzo
a5c0a2215e Dropped whole "critical" story
It doesn't seem "critical" errors are used anymore. pq_set_critical()
wasn't called anywhere.
2019-03-17 03:49:34 +00:00
Daniele Varrazzo
17a074b30a Use the error on the connection instead of passing it explicitly around 2019-03-17 03:49:34 +00:00
Daniele Varrazzo
97220eadc6 Added helper methods to set a result into a connection/cursor 2019-03-17 03:49:34 +00:00
Daniele Varrazzo
e740c21ee6 Dropped pgconn argument from conn_setup() 2019-03-17 03:49:34 +00:00
Daniele Varrazzo
c15e4c1a85 Use the connection's PGresult to pass results through calls 2019-03-17 03:49:34 +00:00
Daniele Varrazzo
5957a7ee45 Fixed handling of internal query too large 2019-03-17 03:49:34 +00:00
Daniele Varrazzo
917335eacb Merge branch 'fix-856' 2019-03-17 03:48:40 +00:00
Daniele Varrazzo
963123812d Make sure to free the connection's pgres on delete 2019-03-17 02:25:45 +00:00
Daniele Varrazzo
734845b79a Added pq_get_result_async() replaced pg_get_last_result()
The new function keeps together PQconsumeInput() with PQisBusy(), in
order to handle the condition in which not all the results of a sequence
of statements arrive in the same roundtrip.

Added pointer to a PGresult to the connection to keep the state across
async communication: it can probably be used to simplify other code
paths where a result is brought forward manually.

Close #802
Close #855
Close #856
2019-03-17 01:20:06 +00:00
Daniele Varrazzo
761c3784c4 Retrieving the async cursor moved out of conn_poll() body 2019-03-16 20:05:40 +00:00
Daniele Varrazzo
e864050d07 Simplified interactions between asyc functions
Have advance_write calling flush itself, advance_read calling is_busy
itself, rather than calling them in the caller and passing the result.

Why we were doing the former on write I don't know. On read the paths
between async and green function was different but they got unified in
the previous commit.
2019-03-16 20:05:40 +00:00
Daniele Varrazzo
2a8fa4bef7 Dropped locking version of pq_is_busy()
The locking version was used for sync connections, the non-locking one
for green ones. However it only calls non-blocking functions, so it
doesn't really matter releasing the gil. So have only the non-locking
one.

Note that the name are sort of swapped: pq_is_busy() does now what
pq_is_busy_locked() used to do.
2019-03-16 20:05:40 +00:00
Daniele Varrazzo
5467f65122 Dropped no_begin handling in async execute
no_begin is only used with withhold named cursors, and it's not possible
to create named cursors on async connections.
2019-03-16 20:05:40 +00:00
Daniele Varrazzo
0935c9d8ca Dropped debug info for microprotocols/adapters initialization
Not useful anymore (guess they were when those layers were created).
Much shorter stream of messages on module init now.
2019-03-16 20:05:40 +00:00
Daniele Varrazzo
d61c902230 Shorter timeout in the async tests select 2019-03-16 20:05:40 +00:00
Daniele Varrazzo
b5c7c93092 Merge branch 'version-check-cleanup' 2019-03-16 19:55:17 +00:00
Daniele Varrazzo
e922e2a96e Py2/3 compatibility macro definitions rationalized 2019-03-16 19:54:40 +00:00
Daniele Varrazzo
fec0a5587d Fixed check for type == int on Py2 2019-03-16 19:54:40 +00:00
Daniele Varrazzo
b9d0808f95 Added PY_2, PY_3 macros and used uniformly 2019-03-16 19:54:40 +00:00
Daniele Varrazzo
8448b3b840 Dropped conditional compiling dealing with unsupported versions
Also dropped shameful use of PY_MINOR_VERSION.
2019-03-16 19:54:40 +00:00
Daniele Varrazzo
dfb301b42b Use PY2, PY3 for conditional code instead of sys.version_info 2019-03-16 19:54:40 +00:00
Daniele Varrazzo
f4a2630f1a Added PY2, PY3 to compat module 2019-03-16 19:54:40 +00:00
Daniele Varrazzo
4ace9544ff Merge branch 'fix-imports' 2019-03-16 19:53:45 +00:00
Daniele Varrazzo
e8135ee2cf Use errors module to catch a specific postgres error 2019-03-16 19:13:58 +00:00
Daniele Varrazzo
b0119fef81 Other import moved to top level in tests 2019-03-16 19:13:58 +00:00
Daniele Varrazzo
8cfe176a85 Dropped repeated conditional import of reload in test 2019-03-16 19:04:40 +00:00
Daniele Varrazzo
aaba4dcf87 TextIOBase moved to tests compat imports 2019-03-16 18:41:59 +00:00
Jon Dufresne
d90ad8627d Move imports to the top of the module across tests
Allows removing many duplicate imports and better follows PEP8
guidelines:

https://www.python.org/dev/peps/pep-0008/#imports

> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.
2019-03-16 18:03:41 +00:00
Jon Dufresne
194efc4375 Fix invalid exception handler: except e:
Fixes flake8 warning:

    ./tests/test_connection.py:390:16: F821 undefined name 'e'
    ./tests/test_connection.py:391:61: F821 undefined name 'e'
    ./tests/test_connection.py:408:16: F821 undefined name 'e'
    ./tests/test_connection.py:409:61: F821 undefined name 'e'

In the event of an unexpected error, let the exception bubble up the
stack for a more informative test failure message.
2019-03-16 17:59:18 +00:00
Jon Dufresne
432fdd7d32 Removed support for mxDateTime as the default date and time adapter
The use_pydatetime configuration option has been removed. Now, always
default to Python's builtin datetime. mxDatetime support continues to be
available as an alternative to Python's builtin datetime.
2019-03-16 16:36:49 +00:00
Jon Dufresne
8685120485 Remove unnecessary except ImportError for Python datetime types
The Python datetime module is available on all supported platforms. The
types are always available and never raise an ImportError.
2019-03-16 16:35:51 +00:00
Jon Dufresne
ad4c6a4673 Use unittest 'skip' feature to skip mxDateTimeTests
Rather than deleting, the class, use the skip feature. Provides a more
informative message during test output.

Never skip DatetimeTests as all supported Python environments have the
datetime module builtin.
2019-03-13 15:01:34 +00:00
Jon Dufresne
d411dc3a73 Remove unused use_pydatetime from setup.py
Looks to have been mistakenly reintroduced in
b537404487.
2019-03-13 15:00:25 +00:00
Jon Dufresne
6db347b5d7 Remove unused use_pg_dll from setup.py
Unused since 3076046b3f.
2019-03-13 11:20:27 +00:00
Jon Dufresne
3f890f8bbe Use True/False instead of 1/0 to represent bool values
Slightly more modern, readable, and Pythonic.
2019-03-13 11:13:36 +00:00
Jon Dufresne
afbbdd18b6 Remove unused variable
The variable i is immediately overwritten by the next line.
2019-03-13 11:13:24 +00:00
Jon Dufresne
03bb44dd2c Convert while 1: statements to while True:
A slightly more readable and modern syntax.
2019-03-13 11:13:05 +00:00
Jon Dufresne
18f5d5ad05 Remove unused imports from tests/test_ipaddress.py 2019-03-13 11:12:48 +00:00
Daniele Varrazzo
f2654d3573 Advertise openssl 1.0.2r and libpq 11.2 in wheels 2019-03-13 11:12:17 +00:00
Daniele Varrazzo
92ac3ba4fc Bumped to version 2.8 2019-03-05 17:33:16 +00:00
Daniele Varrazzo
3ae9dfd545 Better link from docs to "json and jsonb" data types 2019-03-05 17:31:45 +00:00
Daniele Varrazzo
c929f20048 Fixed building with Python 3.8
Not released yet, and using an internal API, so for the moment better
not declare it supported.

Close #854
2019-03-05 17:30:52 +00:00
Daniele Varrazzo
be7e1916d7 Dropped outdated setup.py comment 2019-02-26 23:48:20 +00:00
Grey Baker
7fadb75097 Add project_urls to setup.py, with links to source and documentation 2019-02-26 23:44:32 +00:00
David Fischer
147ff65e4a Fix typo 2019-02-26 11:33:48 +01:00
Daniele Varrazzo
b17670a27e Merge branch 'info-dsn-params' 2019-02-17 10:55:12 +00:00
Daniele Varrazzo
a68df50c7b Added ConnectionInfo.dsn_parameters attribute 2019-02-17 02:37:09 +00:00
Daniele Varrazzo
0eb4560771 Don't use versions such as 2.8.0 in docs
Use 2.8.
2019-02-17 01:51:06 +00:00
Daniele Varrazzo
599432552a Copyright year updated
ag -l Copyright | xargs sed -i \
        "s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*\)/\1-$(date +%Y)\3/I"
2019-02-17 01:36:36 +00:00
Daniele Varrazzo
d177fa9bd0 Allow building docs with Python 3
Use a .pth file to simplify finding the just-built psycopg package into the
docs building env.
2019-02-17 01:36:36 +00:00