]> git.ipfire.org Git - thirdparty/psycopg.git/commit
Declare all loaders to receive an object supporting the buffer interface
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 16 Jan 2021 02:06:56 +0000 (03:06 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 16 Jan 2021 10:26:19 +0000 (11:26 +0100)
commit422f53ff13170dfa95abbd7be7a25302025b8c64
treeb6bd7da94b572d96195312e2c69db7ca60909968
parent7d8b2fda0b2adb9839bee8750a7426c74f1dc826
Declare all loaders to receive an object supporting the buffer interface

There isn't in mypy such an object, so just use `Union[bytes, bytearray,
memoryview]`

Avoid a memory copy passing data from the Transformer to the loaders.

I had started exercising this code path by adding copy tests, but after
dropping the extra copy the same path is now exercised by any select, so
I've stopped doing that.
19 files changed:
psycopg3/psycopg3/adapt.py
psycopg3/psycopg3/proto.py
psycopg3/psycopg3/types/array.py
psycopg3/psycopg3/types/composite.py
psycopg3/psycopg3/types/date.py
psycopg3/psycopg3/types/json.py
psycopg3/psycopg3/types/network.py
psycopg3/psycopg3/types/numeric.py
psycopg3/psycopg3/types/range.py
psycopg3/psycopg3/types/singletons.py
psycopg3/psycopg3/types/text.py
psycopg3/psycopg3/types/uuid.py
psycopg3_c/psycopg3_c/_psycopg3/transform.pyx
tests/test_adapt.py
tests/types/test_array.py
tests/types/test_json.py
tests/types/test_network.py
tests/types/test_text.py
tests/types/test_uuid.py