# Support only depends on the libpq functions available in the pq
# wrapper, not on the database version.
pq_version = pq.__build_version__ or pq.version()
- BasePipeline._is_supported = pq_version >= 140000
+ # Pipeline support broken in libpq 14.5 (#350)
+ BasePipeline._is_supported = pq_version >= 140000 and pq_version != 140005
return BasePipeline._is_supported
def _enter_gen(self) -> PQGen[None]:
import os
import logging
-from typing import Callable, List, Optional, Type
+from typing import Callable, List, Type
from . import abc
from .misc import ConninfoOption, PGnotify, PGresAttDesc
Possible values include ``python``, ``c``, ``binary``.
"""
-__build_version__: Optional[int]
+__build_version__: int
"""The libpq version the C package was built with.
A number in the same format of `~psycopg.ConnectionInfo.server_version`
representing the libpq used to build the speedup module (``c``, ``binary``) if
-available. `!None` if `__impl__` is ``python``.
+available.
Certain features might not be available if the built version is too old.
"""
Conninfo = module.Conninfo
Escaping = module.Escaping
PGcancel = module.PGcancel
- __build_version__ = getattr(module, "__build_version__", None)
+ __build_version__ = module.__build_version__
elif impl:
raise ImportError(f"requested psycopg implementation '{impl}' unknown")
else:
# disable libcrypto setup in libpq, so it won't stomp on the callbacks
# that have already been set up
impl.PQinitOpenSSL(1, 0)
+
+__build_version__ = version()
@pytest.fixture
def trace(libpq):
- pqver = pq.__build_version__ or pq.version()
+ pqver = pq.__build_version__
if pqver < 140000:
pytest.skip(f"trace not available on libpq {pqver}")
if sys.platform != "linux":
def test_build_version():
- if pq.__impl__ == "python":
- assert pq.__build_version__ is None
- elif pq.__impl__ in ["c", "binary"]:
- assert pq.__build_version__ and pq.__build_version__ >= 70400
- else:
- assert False, f"unexpected libpq implementation: {pq.__impl__}"
+ assert pq.__build_version__ and pq.__build_version__ >= 70400
@pytest.mark.skipif("not os.environ.get('PSYCOPG_TEST_WANT_LIBPQ_BUILD')")