]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore(json): adapt caching types definition to Python 3.8 1115/head
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 4 Jul 2025 23:24:11 +0000 (01:24 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Jul 2025 17:01:24 +0000 (19:01 +0200)
psycopg/psycopg/types/json.py
tests/types/test_json.py

index 6c93baf3436b0f1b535e46a6465eb75d9e14bac1..83ce719fa5379ff537bc80d8464d457c33313f90 100644 (file)
@@ -8,7 +8,7 @@ from __future__ import annotations
 
 import json
 import logging
-from types import CodeType
+from types import CodeType  # noqa[F401]
 from typing import Any, Callable
 from warnings import warn
 from threading import Lock
@@ -22,7 +22,7 @@ from .._compat import TypeAlias
 
 JsonDumpsFunction: TypeAlias = Callable[[Any], "str | bytes"]
 JsonLoadsFunction: TypeAlias = Callable[["str | bytes"], Any]
-_AdapterKey: TypeAlias = tuple[type, CodeType]
+_AdapterKey: TypeAlias = "tuple[type, CodeType]"
 
 logger = logging.getLogger("psycopg")
 
index faae9e66201b4067b1ba45f40f6c1b94a6c42502..2c670da88263778c825d2aeb6aded70518ecce33 100644 (file)
@@ -269,7 +269,7 @@ def test_load_leak_with_local_functions(dsn, binary, pgtype, caplog):
 
     def register(conn: psycopg.Connection) -> None:
 
-        def f(x: str | bytes) -> Any:
+        def f(x: "str | bytes") -> Any:
             return json.loads(x)
 
         set_json_loads(f, conn)