]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: upgrade usage lru_cache decorator for Python 3.8+
authorDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 4 Jun 2024 07:33:34 +0000 (09:33 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 4 Jun 2024 19:03:55 +0000 (21:03 +0200)
docs/lib/libpq_docs.py
psycopg/psycopg/_conninfo_utils.py
psycopg/psycopg/_queries.py

index 2868916f5e89c9893ee3f6b33dc1f2fb1a622010..e072d0658c93e2f795dd143ccc889b263222c99e 100644 (file)
@@ -143,7 +143,7 @@ class LibpqReader:
         return self.app.config.libpq_docs_version
 
 
-@lru_cache()
+@lru_cache
 def get_reader():
     return LibpqReader()
 
index 68fb7b3a2be8646cd77c28e67759eee19f5ac9e6..4e7025d3e1c26b2029c36b740b50b4bd0c6d8632 100644 (file)
@@ -114,7 +114,7 @@ def get_param_def(keyword: str, _cache: dict[str, ParamDef] = {}) -> ParamDef |
     return _cache.get(keyword)
 
 
-@lru_cache()
+@lru_cache
 def is_ip_address(s: str) -> bool:
     """Return True if the string represent a valid ip address."""
     try:
index 537a656694c53ab54241348cbcb025e9da750843..3368e79d1ad01cb0a3927b1724670a26908af3d4 100644 (file)
@@ -228,7 +228,7 @@ def _query2pg_nocache(
 # records), and the resulting cache size is >100Mb. So, we will avoid to cache
 # large queries or queries with a large number of params. See
 # https://github.com/sqlalchemy/sqlalchemy/discussions/10270
-_query2pg = lru_cache()(_query2pg_nocache)
+_query2pg = lru_cache(_query2pg_nocache)
 
 
 class PostgresClientQuery(PostgresQuery):
@@ -326,7 +326,7 @@ def _query2pg_client_nocache(
     return b"".join(chunks), order, parts
 
 
-_query2pg_client = lru_cache()(_query2pg_client_nocache)
+_query2pg_client = lru_cache(_query2pg_client_nocache)
 
 
 _re_placeholder = re.compile(