]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
22 months agofix: cache all dynamically generated adapter types 649/head
Daniele Varrazzo [Mon, 25 Sep 2023 15:19:53 +0000 (17:19 +0200)] 
fix: cache all dynamically generated adapter types

These are not currently a leak in cPython, but I don't think it's
guaranteed anywhere, and it might well not be the case in other Python
implementations. So, as a matter of hygiene, make sure that calling
register_*() in a loop doesn't create an unbound number of new types.

22 months agofix: cache dynamic adapters created in register_array()
Daniele Varrazzo [Mon, 25 Sep 2023 22:26:56 +0000 (00:26 +0200)] 
fix: cache dynamic adapters created in register_array()

If the base class is a C extension, the subclasses cannot be GC'd. This
results in a leak if register_array() is called in a loop.

Close #647

22 months agochore: bump psycopg_pool package version to 3.1.9.dev1
Daniele Varrazzo [Sat, 23 Sep 2023 11:32:45 +0000 (13:32 +0200)] 
chore: bump psycopg_pool package version to 3.1.9.dev1

22 months agochore: bump psycopg package version to 3.1.12.dev1
Daniele Varrazzo [Sat, 23 Sep 2023 11:32:37 +0000 (13:32 +0200)] 
chore: bump psycopg package version to 3.1.12.dev1

22 months agochore: bump psycopg_pool package version to 3.1.8 3.1.11 pool-3.1.8
Daniele Varrazzo [Fri, 22 Sep 2023 22:08:43 +0000 (00:08 +0200)] 
chore: bump psycopg_pool package version to 3.1.8

22 months agochore: bump psycopg package version to 3.1.11
Daniele Varrazzo [Fri, 22 Sep 2023 22:08:01 +0000 (00:08 +0200)] 
chore: bump psycopg package version to 3.1.11

22 months agodocs: Document what to do when a new major version of Postgres is released
Daniele Varrazzo [Fri, 22 Sep 2023 21:44:42 +0000 (23:44 +0200)] 
docs: Document what to do when a new major version of Postgres is released

22 months agoci: provision a M1 build server automatically, if needed
Daniele Varrazzo [Fri, 22 Sep 2023 20:36:27 +0000 (22:36 +0200)] 
ci: provision a M1 build server automatically, if needed

22 months agochore: upgrade libpq, OpenSSL versions
Daniele Varrazzo [Fri, 22 Sep 2023 21:31:46 +0000 (23:31 +0200)] 
chore: upgrade libpq, OpenSSL versions

22 months agofix(bump_version): handle tagging without bumping version
Daniele Varrazzo [Fri, 22 Sep 2023 23:07:03 +0000 (01:07 +0200)] 
fix(bump_version): handle tagging without bumping version

22 months agoci: run 3rd party integration tests on commit on maint-3.1 branch
Daniele Varrazzo [Fri, 22 Sep 2023 22:23:07 +0000 (00:23 +0200)] 
ci: run 3rd party integration tests on commit on maint-3.1 branch

22 months agochore: update cibuildwheel version
Daniele Varrazzo [Fri, 22 Sep 2023 21:32:16 +0000 (23:32 +0200)] 
chore: update cibuildwheel version

22 months agochore: upgrade libpq, OpenSSL versions
Daniele Varrazzo [Fri, 22 Sep 2023 21:31:46 +0000 (23:31 +0200)] 
chore: upgrade libpq, OpenSSL versions

22 months agodocs: refresh stale release information
Daniele Varrazzo [Fri, 22 Sep 2023 21:23:47 +0000 (23:23 +0200)] 
docs: refresh stale release information

22 months agoperf(windows): don't use wait_c.
Daniele Varrazzo [Tue, 19 Sep 2023 20:38:03 +0000 (22:38 +0200)] 
perf(windows): don't use wait_c.

The function was reported to use excessive CPU. Need to investigate,
however, for the moment, suspend its usage on Windows.

See #645.

22 months agofix(c): fix loading of intervals with days and months or years
Daniele Varrazzo [Tue, 19 Sep 2023 19:07:20 +0000 (21:07 +0200)] 
fix(c): fix loading of intervals with days and months or years

Close #643.

22 months agoci: fix building Python 3.7 extension on windows using delvewheel 1.5.1
Daniele Varrazzo [Fri, 15 Sep 2023 15:35:58 +0000 (17:35 +0200)] 
ci: fix building Python 3.7 extension on windows using delvewheel 1.5.1

See https://github.com/adang1345/delvewheel/issues/39

22 months agostyle: move private functions closer to the classes where they are used
Daniele Varrazzo [Mon, 11 Sep 2023 00:54:02 +0000 (01:54 +0100)] 
style: move private functions closer to the classes where they are used

For better alignment with the master branch.

22 months agofix: avoid caching the parsing of large queries
Daniele Varrazzo [Mon, 4 Sep 2023 13:42:00 +0000 (14:42 +0100)] 
fix: avoid caching the parsing of large queries

These queries are typically generated by ORMs and have poor
cacheability, but can result in a lot of memory being used.

Close #628.

See also <https://github.com/sqlalchemy/sqlalchemy/discussions/10270>.

22 months agoRevert "chore(binary): bump depending libraries"
Daniele Varrazzo [Mon, 4 Sep 2023 14:03:24 +0000 (15:03 +0100)] 
Revert "chore(binary): bump depending libraries"

This reverts commit d424be88f63ee0d56088bcbc85904cdcc4fc48b8.

The commit only bumped the defaults in the build script, but actually
the proper version is in the workflow file. A libpq version fixing #528
was already released with psycopg-binary 3.1.10.

23 months agochore(binary): bump depending libraries
Daniele Varrazzo [Mon, 4 Sep 2023 00:16:35 +0000 (01:16 +0100)] 
chore(binary): bump depending libraries

Bump to libpq 15.4, OpenSSL 1.1.1v, OpenLDAP 2.6.6.

Particularly important is the libpq bump because the library, since
15.2, allows group access to the SSL certificate. See
https://github.com/psycopg/psycopg/discussions/528

23 months agochore: avoid anyio >= 4 for the moment
Daniele Varrazzo [Fri, 1 Sep 2023 10:46:01 +0000 (11:46 +0100)] 
chore: avoid anyio >= 4 for the moment

The 'policy' parameter is not supported anymore, and finding the right
workaround is tricky, especially because it's only needed for Windows,
and because anyio 4 doesn't support Python 3.7, so we would need to
support both the versions.

When we will drop Python 3.7 support it will be easier move to anyio >= 4.

23 months agoMerge branch 'fix-solaris' into maint-3.1
Daniele Varrazzo [Fri, 1 Sep 2023 12:33:46 +0000 (13:33 +0100)] 
Merge branch 'fix-solaris' into maint-3.1

23 months agodocs: mention fix for solaris build
Daniele Varrazzo [Fri, 1 Sep 2023 12:32:51 +0000 (13:32 +0100)] 
docs: mention fix for solaris build

23 months agofix: support solaris and deriv
Gaige B. Paulsen [Thu, 31 Aug 2023 11:40:44 +0000 (11:40 +0000)] 
fix: support solaris and deriv

23 months agofix: add missing pipeline sync in async cursro scroll().
Daniele Varrazzo [Sat, 19 Aug 2023 17:23:38 +0000 (18:23 +0100)] 
fix: add missing pipeline sync in async cursro scroll().

23 months agofix: add missing lock in async executemany with no pipeline
Daniele Varrazzo [Sat, 19 Aug 2023 17:23:38 +0000 (18:23 +0100)] 
fix: add missing lock in async executemany with no pipeline

23 months agoMerge branch 'fix-oid-overflow' into maint-3.1
Daniele Varrazzo [Fri, 1 Sep 2023 10:48:52 +0000 (11:48 +0100)] 
Merge branch 'fix-oid-overflow' into maint-3.1

23 months agodocs: add news entry about bug #630 fixed
Daniele Varrazzo [Wed, 23 Aug 2023 14:39:54 +0000 (15:39 +0100)] 
docs: add news entry about bug #630 fixed

23 months ago* fix integer overflow for oids > 2^31
David Grimes [Wed, 23 Aug 2023 13:37:50 +0000 (09:37 -0400)] 
* fix integer overflow for oids > 2^31

23 months agofix: rename QueuedLibpqWriter object
Daniele Varrazzo [Thu, 10 Aug 2023 00:37:22 +0000 (01:37 +0100)] 
fix: rename QueuedLibpqWriter object

It was mistakenly named Driver, not Writer.

23 months agofix: fix infinite loop and OOM in bad executemany
Daniele Varrazzo [Sat, 5 Aug 2023 21:15:05 +0000 (22:15 +0100)] 
fix: fix infinite loop and OOM in bad executemany

The bad condition is only reached using COPY into executemany in
pipeline mode and with prepared statements disabled. It should probably
never happen outside the unit test.

23 months agochore: bump psycopg package version to 3.1.11.dev1
Daniele Varrazzo [Sat, 5 Aug 2023 14:04:59 +0000 (15:04 +0100)] 
chore: bump psycopg package version to 3.1.11.dev1

23 months agochore: bump psycopg package version to 3.1.10 3.1.10
Daniele Varrazzo [Fri, 4 Aug 2023 14:55:12 +0000 (15:55 +0100)] 
chore: bump psycopg package version to 3.1.10

23 months agochore: upgrade cibuildwheel
Daniele Varrazzo [Fri, 4 Aug 2023 15:06:01 +0000 (16:06 +0100)] 
chore: upgrade cibuildwheel

23 months agochore: bump libpq, openssl used in binary packages
Daniele Varrazzo [Fri, 4 Aug 2023 15:02:29 +0000 (16:02 +0100)] 
chore: bump libpq, openssl used in binary packages

2 years agoMark two more tests as timing-sensitive
Martin Weinelt [Wed, 2 Aug 2023 01:59:23 +0000 (03:59 +0200)] 
Mark two more tests as timing-sensitive

FAILED tests/pool/test_pool_async.py::test_reconnect[asyncio] - AssertionError: [0.11509847640991211, 0.2041318416595459, 0.40631914138793945]
FAILED tests/pool/test_pool.py::test_reconnect - ValueError: the proxy didn't start listening in time

2 years agoMerge branch 'pipeline-nextset-warning' into maint-3.1
Daniele Varrazzo [Wed, 2 Aug 2023 00:03:28 +0000 (01:03 +0100)] 
Merge branch 'pipeline-nextset-warning' into maint-3.1

2 years agofix: raise a warning if nextset is used after execute in pipeline mode 613/head
Daniele Varrazzo [Tue, 1 Aug 2023 10:57:48 +0000 (11:57 +0100)] 
fix: raise a warning if nextset is used after execute in pipeline mode

So far have accumulated results, unlike in no-pipeline mode, where
results have been discarded. But this proved to be not reliable, so we
will forbid it in 3.2.

See #604

2 years agodocs: drop example about using nextset() in pipeline mode
Daniele Varrazzo [Tue, 1 Aug 2023 11:04:33 +0000 (12:04 +0100)] 
docs: drop example about using nextset() in pipeline mode

The feature is sort of accidental, not tested, and proved to be not
reliable, so we will remove it in 3.2.

See #604.

2 years agodocs: fix release version of json bytes dump support
Daniele Varrazzo [Tue, 1 Aug 2023 10:11:50 +0000 (11:11 +0100)] 
docs: fix release version of json bytes dump support

It is to be released in 3.1.10, not already released in 3.1.9... See #568

2 years agoMerge branch 'py312-3.1' into maint-3.1
Daniele Varrazzo [Tue, 1 Aug 2023 02:54:18 +0000 (03:54 +0100)] 
Merge branch 'py312-3.1' into maint-3.1

2 years agodocs: mention Python 3.12 support in news file
Daniele Varrazzo [Tue, 1 Aug 2023 02:48:52 +0000 (03:48 +0100)] 
docs: mention Python 3.12 support in news file

2 years agoci: bump Python 3.12 test version to beta 4
Daniele Varrazzo [Mon, 31 Jul 2023 23:56:51 +0000 (00:56 +0100)] 
ci: bump Python 3.12 test version to beta 4

2 years agotest: mark tests as failing to monitoring strange behaviour with Python 3.12
Daniele Varrazzo [Wed, 24 May 2023 23:09:09 +0000 (01:09 +0200)] 
test: mark tests as failing to monitoring strange behaviour with Python 3.12

With Python 3.12a7 and Cython-3.0.0b3, these two tests fails. It seems
that when an exception is involved the __del__ method is not called.

2 years agoci: set up test grid to test Python 3.12
Daniele Varrazzo [Wed, 24 May 2023 23:14:09 +0000 (01:14 +0200)] 
ci: set up test grid to test Python 3.12

2 years agochore: declare Python 3.12 supported in classifiers
Daniele Varrazzo [Wed, 24 May 2023 23:08:50 +0000 (01:08 +0200)] 
chore: declare Python 3.12 supported in classifiers

2 years agochore: upgrade Cython to stable 3.0.0
Daniele Varrazzo [Wed, 24 May 2023 23:08:26 +0000 (01:08 +0200)] 
chore: upgrade Cython to stable 3.0.0

2 years agofix: fix "can't adapt" error message on Python 3.11
Daniele Varrazzo [Mon, 31 Jul 2023 23:49:04 +0000 (00:49 +0100)] 
fix: fix "can't adapt" error message on Python 3.11

It appeared like "using placeholder '%PyFormat.TEXT'" because of the
change in the Enum display already fixed elsewhere.

Spotted in the conversation in #611.

Also fix unneeded nested exception in the Python version of the code.

2 years agofix: fix resetting read_only/deferrable to default using None
Daniele Varrazzo [Mon, 31 Jul 2023 22:52:45 +0000 (23:52 +0100)] 
fix: fix resetting read_only/deferrable to default using None

2 years agoMerge branch 'fix-591-3.1' into maint-3.1
Daniele Varrazzo [Mon, 24 Jul 2023 10:18:22 +0000 (11:18 +0100)] 
Merge branch 'fix-591-3.1' into maint-3.1

2 years agofix: fix possible errors calling __repr__ from __del__.
Daniele Varrazzo [Sun, 23 Jul 2023 19:33:05 +0000 (20:33 +0100)] 
fix: fix possible errors calling __repr__ from __del__.

The errors get ignored but print a warning on program exit and eclipse a
genuine warning.

The error is caused by the `pq.misc` module getting gc'd on interpreter
shutdown before `connection_summary()` is called. The solution is to
import `connection_summary` in the module namespace, which is similar to
the solution that proved working for #198. It is less robust than the
solution used by the Python devs to import the function in the method
via an argument default, but it should work adequately (as nobody
complained about #198 anymore).

In #591 discussion, I proposed that connection_summary is too complex to
be considered safe to call on __del__. Actually, looking at it, it seems
innocent enough, as it only calls objects methods, no functions from
module namespaces. As a consequence we assume that this commit fixes the
issue. As I can't reproduce it, will ask the OP if this is the case.

Close #591.

2 years agoMerge branch 'fix-copy-cancel-clobbering-exception' into maint-3.1
Daniele Varrazzo [Sat, 22 Jul 2023 21:05:34 +0000 (22:05 +0100)] 
Merge branch 'fix-copy-cancel-clobbering-exception' into maint-3.1

2 years agofix: don't clobber a Python exception on COPY FROM with QueryCanceled 609/head
Daniele Varrazzo [Fri, 21 Jul 2023 01:10:01 +0000 (02:10 +0100)] 
fix: don't clobber a Python exception on COPY FROM with QueryCanceled

We trigger the server to raise the QueryCanceled; however, the original
exception has more information (the traceback). We can consider the
server exception just a notification that cancellation worked as
expected.

This is a mild change in behaviour, as the fixed tests state. However,
raising QueryCanceled is not explicitly documented and not part of a
strict interface, so we can probably change the exception raised without
needing to wait for psycopg 4.

Close #593

2 years agochore: bump mypy to 1.4.1
Denis Laxalde [Wed, 12 Jul 2023 06:39:51 +0000 (08:39 +0200)] 
chore: bump mypy to 1.4.1

The issue previously mentioned about '# type: ignore[arg-type]' in
rows.py got resolved.

The new '# type: ignore[comparison-overlap]' in test_pipeline*.py are
due to https://github.com/python/mypy/issues/15509, a known regression
from Mypy 1.4. We use the workaround documented in the release blog post
https://mypy-lang.blogspot.com/2023/06/mypy-140-released.html (section
"Narrowing Enum Values Using “==”").

2 years agoops: fix broken build on Windows amd64
Daniele Varrazzo [Sun, 18 Jun 2023 17:18:09 +0000 (19:18 +0200)] 
ops: fix broken build on Windows amd64

2 years agoMark test_ctrl_c_handler as timing sensitive
Sandro [Tue, 13 Jun 2023 09:34:55 +0000 (11:34 +0200)] 
Mark test_ctrl_c_handler as timing sensitive

psycopg> =================================== FAILURES ===================================
psycopg> _____________________________ test_ctrl_c_handler ______________________________
psycopg>         t0 = time.time()
psycopg>         proc = sp.Popen([sys.executable, "-s", "-c", script], creationflags=creationflags)
psycopg>         proc.communicate()
psycopg>         t = time.time() - t0
psycopg>         assert proc.returncode == 0
psycopg> >       assert 1 < t < 2
psycopg> E       assert 3.7456982135772705 < 2
psycopg>
psycopg> tests/test_concurrency.py:293: AssertionError

2 years agoMerge branch 'fix-565-3.1' into maint-3.1
Daniele Varrazzo [Tue, 13 Jun 2023 14:03:52 +0000 (16:03 +0200)] 
Merge branch 'fix-565-3.1' into maint-3.1

2 years agofix: finish the PGconn upon connection failure
Denis Laxalde [Fri, 19 May 2023 07:06:55 +0000 (09:06 +0200)] 
fix: finish the PGconn upon connection failure

Attaching the non-finished PGconn to exceptions raised in connect() is
causing problem, as described in issue #565, because the PGconn might
not get finished soon enough in application code and the socket would
remain open.

On the other hand, just removing the pgconn attribute from Error would
be a breaking change and we'd loose the inspection features introduced
in commit 9220293dc023b757f2a57702c14b1460ff8f25b0.

As an alternative, we define a new PGconn implementation that is
error-specific: it captures all attributes of the original PGconn and
fails upon other operations (methods call). Some attributes have a
default value since they are not available in old PostgreSQL versions.

Finally, the (real) PGconn is finished before raising exception in
generators.connect().

2 years agochore: add a trailing comma in Error.__init__() to make black happy
Denis Laxalde [Fri, 19 May 2023 07:06:55 +0000 (09:06 +0200)] 
chore: add a trailing comma in Error.__init__() to make black happy

2 years agotests: check that OperationalError raised by connect() holds a pgconn
Denis Laxalde [Tue, 16 May 2023 11:28:37 +0000 (13:28 +0200)] 
tests: check that OperationalError raised by connect() holds a pgconn

Sort of a non-regression test for the part of commit
9220293dc023b757f2a57702c14b1460ff8f25b0 concerning generators. It used
roughly the same logic as tests/pq/test_pgconn.py::test_used_password()
to determine if the test connection needs a password and gets skipped
otherwise.

2 years agofix(pool): check connections' max_lifetime on ``check()``
Daniele Varrazzo [Thu, 8 Jun 2023 13:56:22 +0000 (15:56 +0200)] 
fix(pool): check connections' max_lifetime on ``check()``

Close #482

2 years agoMerge branch 'fix-585-3.1' into maint-3.1
Daniele Varrazzo [Mon, 12 Jun 2023 23:17:40 +0000 (01:17 +0200)] 
Merge branch 'fix-585-3.1' into maint-3.1

2 years agofix: always validate PrepareManager cache in pipeline mode
Denis Laxalde [Thu, 8 Jun 2023 09:21:42 +0000 (11:21 +0200)] 
fix: always validate PrepareManager cache in pipeline mode

Previously, when processing results in pipeline mode
(BasePipeline._process_results()), we'd run
'cursor._check_results(results)' early before calling
_prepared.validate() with prepared statement information. However, if
this check step fails, for example if the pipeline got aborted due to a
previous error, the latter step (PrepareManager cache validation) was
not run.

We fix this by reversing the logic, and checking results last.

However, this is not enough, because the results processing logic in
BasePipeline._fetch_gen() or _communicate_gen(), which sequentially
walked through fetched results, would typically stop at the first
exception and thus possibly never go through the step of validating
PrepareManager cache if a previous error happened.

We fix that by making sure that *all* results are processed, possibly
capturing the first exception and then re-raising it. In both
_communicate_gen() and _fetch_gen(), we no longer store results in the
'to_process' like, but process then upon reception as this logic is no
longer needed.

Fix #585.

2 years agodocs: adjust PrepareManager.validate() docstring
Denis Laxalde [Thu, 8 Jun 2023 12:03:18 +0000 (14:03 +0200)] 
docs: adjust PrepareManager.validate() docstring

From commit bfabe88aba4769e0a44206e1ace7c299991a957d, the method does
not return a command, but it records it through _rotate().

2 years agodocs: remove outdated comments in PrepareManager's docstrings
Denis Laxalde [Thu, 8 Jun 2023 11:38:44 +0000 (13:38 +0200)] 
docs: remove outdated comments in PrepareManager's docstrings

PrepareManager's methods maybe_add_to_cache() and validate() are said to
only be used in pipeline mode, but this is wrong as can be seen in
BaseCursor._maybe_prepare_gen(). (Comments are probably a left-over from
a prior implementation of the pipeline mode.)

2 years agofeat: allow binary JSON dumps
Lionel Panhaleux [Fri, 19 May 2023 12:03:29 +0000 (14:03 +0200)] 
feat: allow binary JSON dumps

Some JSON libraries, in particular the widespread
[orjson](https://github.com/ijl/orjson#quickstart) library, directly
dump data in binary format.

This change allows it and avoids having to decode/encode in these cases
by testing the return type of the `dumps` function.

2 years agoAdded minimal Django integration tests.
Florian Apolloner [Sat, 15 Apr 2023 08:13:34 +0000 (10:13 +0200)] 
Added minimal Django integration tests.

2 years agochore: bump psycopg package version to 3.1.10.dev1
Daniele Varrazzo [Tue, 2 May 2023 14:29:25 +0000 (16:29 +0200)] 
chore: bump psycopg package version to 3.1.10.dev1

2 years agochore: bump psycopg package version to 3.1.9 3.1.9
Daniele Varrazzo [Tue, 2 May 2023 10:56:24 +0000 (12:56 +0200)] 
chore: bump psycopg package version to 3.1.9

2 years agoMerge branch 'fix-json-dump-dict-3.1' into maint-3.1
Daniele Varrazzo [Tue, 2 May 2023 10:54:22 +0000 (12:54 +0200)] 
Merge branch 'fix-json-dump-dict-3.1' into maint-3.1

2 years agotest(json): fix dict registration test on crdb
Daniele Varrazzo [Mon, 17 Apr 2023 21:52:06 +0000 (23:52 +0200)] 
test(json): fix dict registration test on crdb

2 years agofix(json): allow to register json dumpers on dict or other objects
Daniele Varrazzo [Mon, 10 Apr 2023 20:55:44 +0000 (22:55 +0200)] 
fix(json): allow to register json dumpers on dict or other objects

2 years agofix: don't reuse the same Transformer in composite dumper 550/head
Daniele Varrazzo [Sun, 16 Apr 2023 01:30:37 +0000 (03:30 +0200)] 
fix: don't reuse the same Transformer in composite dumper

We need different dumpers because, in case a composite contains another
composite, we need to call `dump_sequence()` on different sequences, so
we row dumpers must be distinct.

Close #547

2 years agodocs: fix cursor -> connection in the context of transaction management
Daniele Varrazzo [Thu, 13 Apr 2023 21:23:14 +0000 (23:23 +0200)] 
docs: fix cursor -> connection in the context of transaction management

Close #548

2 years agofix: don't use select as wait function if possible
Daniele Varrazzo [Sun, 9 Apr 2023 18:59:55 +0000 (20:59 +0200)] 
fix: don't use select as wait function if possible

select is marginally faster than others, but has the limitation of not
allowing FD > 1024, so it is not a good default.

If people need performance, they will use wait_c anyway, which is based
on poll, and doesn't have the limitation.

2 years agofix: fix loading of different 'record' types in the same query
Daniele Varrazzo [Sun, 9 Apr 2023 19:31:27 +0000 (21:31 +0200)] 
fix: fix loading of different 'record' types in the same query

Different records in the same query might have different types.
Use a separate transformer for each sequence of types.

2 years agofix: don't use select as wait function if possible
Daniele Varrazzo [Sun, 9 Apr 2023 18:59:55 +0000 (20:59 +0200)] 
fix: don't use select as wait function if possible

select is marginally faster than others, but has the limitation of not
allowing FD > 1024, so it is not a good default.

If people need performance, they will use wait_c anyway, which is based
on poll, and doesn't have the limitation.

2 years agofix: shorter traceback on ctrl-c interrupt
Daniele Varrazzo [Sun, 9 Apr 2023 18:45:09 +0000 (20:45 +0200)] 
fix: shorter traceback on ctrl-c interrupt

2 years agofix(async): cancel query upon receiving CanceledError in async wait
Daniele Varrazzo [Sun, 9 Apr 2023 18:29:44 +0000 (20:29 +0200)] 
fix(async): cancel query upon receiving CanceledError in async wait

This interrupt a running query upon Ctrl-C for example, which wasn't
working as it was on sync connection.

Close #543.

2 years agochore: bump mypy to 1.2
Daniele Varrazzo [Sun, 9 Apr 2023 23:42:14 +0000 (01:42 +0200)] 
chore: bump mypy to 1.2

2 years agoFix typo in docs
Jay Turner [Thu, 30 Mar 2023 08:11:18 +0000 (09:11 +0100)] 
Fix typo in docs

2 years agochore: bump psycopg_pool package version to 3.1.8.dev1
Daniele Varrazzo [Mon, 27 Mar 2023 08:41:03 +0000 (10:41 +0200)] 
chore: bump psycopg_pool package version to 3.1.8.dev1

2 years agochore: bump psycopg_pool package version to 3.1.7 pool-3.1.7
Daniele Varrazzo [Mon, 27 Mar 2023 00:07:50 +0000 (02:07 +0200)] 
chore: bump psycopg_pool package version to 3.1.7

2 years agotests: skip test_sql::test_invalid_name if not a super-user
Denis Laxalde [Thu, 23 Mar 2023 08:52:39 +0000 (09:52 +0100)] 
tests: skip test_sql::test_invalid_name if not a super-user

Creating a base type, as done in that test, requires being a superuser.

2 years agoMerge branch 'fix-509-3.1' into maint-3.1
Daniele Varrazzo [Mon, 20 Mar 2023 02:33:57 +0000 (02:33 +0000)] 
Merge branch 'fix-509-3.1' into maint-3.1

2 years agotest(pool): skip cancellation tests on Python 3.7
Daniele Varrazzo [Sun, 19 Mar 2023 19:41:14 +0000 (19:41 +0000)] 
test(pool): skip cancellation tests on Python 3.7

The test hangs forever on Python 3.7, no the gather() statement, and
wait_for() doesn't solve the problem.

2 years agofix(pool): reinforce handling of errors in queued clients
Daniele Varrazzo [Thu, 16 Mar 2023 21:15:51 +0000 (22:15 +0100)] 
fix(pool): reinforce handling of errors in queued clients

Unlike the async counterpart, I have no idea how to test this condition,
because I don't think you can cancel a Python thread. I could put the
pool and the first client in threads and use the main thread as queued
client, but it seems pretty convoluted.

However, an error handling in the same place that fixed #509 in the
async pools doesn't hurt.

2 years agofix(pool): fix handling of errors in queued async tasks
Daniele Varrazzo [Thu, 16 Mar 2023 21:07:05 +0000 (22:07 +0100)] 
fix(pool): fix handling of errors in queued async tasks

Failing to do so, cancelled tasks still in the queue end up consuming
a connection without a chance of returning it, depleting the pool.

Close #509

2 years agotest: mark some scheduler tests time-sensitive
Daniele Varrazzo [Wed, 15 Mar 2023 03:29:32 +0000 (04:29 +0100)] 
test: mark some scheduler tests time-sensitive

Close #502

2 years agofix(c): fix incomplete error message for timestamp too small
Daniele Varrazzo [Wed, 15 Mar 2023 03:24:39 +0000 (04:24 +0100)] 
fix(c): fix incomplete error message for timestamp too small

Close #521.

2 years agodoc: fix pg2pyenc() docstring
Denis Laxalde [Wed, 8 Mar 2023 09:49:54 +0000 (10:49 +0100)] 
doc: fix pg2pyenc() docstring

2 years agoMerge branch 'cython-3.0b1' into maint-3.1
Daniele Varrazzo [Wed, 15 Mar 2023 02:25:37 +0000 (03:25 +0100)] 
Merge branch 'cython-3.0b1' into maint-3.1

2 years agofix(c): add type cast to notice receiver callback
Daniele Varrazzo [Tue, 14 Mar 2023 18:36:20 +0000 (19:36 +0100)] 
fix(c): add type cast to notice receiver callback

Necessary starting from Cython 3.0b1

2 years agofix(c): solve Cython compile warnings
Daniele Varrazzo [Tue, 14 Mar 2023 18:35:57 +0000 (19:35 +0100)] 
fix(c): solve Cython compile warnings

2 years agochore: upgrade to mypy 1.0.0
Denis Laxalde [Sat, 11 Feb 2023 09:51:35 +0000 (10:51 +0100)] 
chore: upgrade to mypy 1.0.0

Some "type: ignore" no longer needed, some need a different kind.

2 years agotests: mark as flaky tests seen failing randomly on release
Daniele Varrazzo [Mon, 6 Feb 2023 21:29:32 +0000 (21:29 +0000)] 
tests: mark as flaky tests seen failing randomly on release

2 years agotest: use Windows asyncio policy in "non-asyncio" pool tests
Denis Laxalde [Sun, 5 Feb 2023 17:40:16 +0000 (18:40 +0100)] 
test: use Windows asyncio policy in "non-asyncio" pool tests

In commit b6cc8343159fc0a27365e09a3beef06433f3f1b5, we drop the global
asyncio.set_event_loop_policy() for Windows in conftest.py, replacing it
with asyncio_options to be used by the anyio test runner. However, test
cases in test_pool_async_noasyncio.py are not "async def" so they would
not use that anyio runner (nor did they use pytest-asyncio's runner
before); but they need the event loop policy for Windows still.
Accordingly, we configure the loop from "anyio_backend_options" in
asyncio_run() fixture.

2 years agotest: use anyio instead of pytest-asyncio
Denis Laxalde [Wed, 17 Aug 2022 13:59:31 +0000 (15:59 +0200)] 
test: use anyio instead of pytest-asyncio

This is in preparation for adding support for other async libraries,
through anyio. AnyIO pytest plugin is used in replacement for
pytest-asyncio:

- either the pytest.mark.asyncio is replaced by pytest.mark.anyio, or,
- we rely on the 'anyio_backend' fixture that is pulled in 'aconn_cls'
  fixture (and hence 'aconn') providing automatic detection for test
  functions using it.

The 'anyio_backend' fixture is parametrized to only use asyncio and
selects the event loop policy we need on Windows platform as previously
done in pytest_sessionstart(), but only for Python version 3.8 or
higher.

This fixture is defined in main conftest.py, as well as in
pool/conftest.py since we'll change the former to support more async
backend while keeping the later asyncio-only for now.

Function test_concurrency_async.py::test_ctrl_c is no longer 'async'
because its code does not directly use asyncio (it's done through a
subprocess); but the 'async def' was needed before in order for
pytest-asyncio to run it since the test module had a global
pytest.mark.asyncio (and we were using the "auto" mode).

2 years agoMerge branch 'fix-503' into maint-3.1
Daniele Varrazzo [Mon, 6 Feb 2023 21:17:22 +0000 (21:17 +0000)] 
Merge branch 'fix-503' into maint-3.1