From a4b7548c9756c742eecc919210eb824b7f4a9a82 Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Tue, 8 Sep 2026 12:27:37 +0530 Subject: [PATCH] fix(deps): pin psycopg[c] back to 3.3.4 The macOS x64 packaging job fails while installing requirements.txt: Preparing metadata (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error exit code: -10 Exit code -10 is SIGBUS. The only output before the crash is setuptools' own `[tool.setuptools.ext-modules] in pyproject.toml is still experimental` warning, so it dies while setuptools reads the project config, well before pg_config is ever invoked. psycopg-c ships no wheels, so every platform compiles it from the sdist. The only build-tooling change between 3.3.4 and 3.3.5 is the strictly pinned build requirement: 3.3.0 - 3.3.4 setuptools == 80.3.1 3.3.5 setuptools == 83.0.0 Because that pin is an equality, PIP_CONSTRAINT cannot override the version inside the isolated build environment - the only ways to keep 3.3.5 are --no-build-isolation with a pre-seeded setuptools (which would fork the macOS build procedure from Linux's) or an upstream fix. Linux builds 3.3.5 fine, so this looks specific to the relocatable-python framework the macOS bundle is built against. Pin to 3.3.4 to unblock the build. The encoding.py rewrite that shipped alongside the 3.3.5 bump stays untouched: it reads the derived py_codecs/pg_codecs dicts, which are plain dicts in both versions. One test expectation was 3.3.5-specific. psycopg 3.3.5 added an ISO88591 alias to its encoding table, so inverting py_codecs resolves iso8859-1 to ISO88591; on 3.3.4 only LATIN1 exists, so get_encoding('LATIN1') returns ['LATIN1', 'iso8859-1'] instead of ['ISO88591', 'iso8859-1']. Both are valid PostgreSQL names for the same encoding, so the scenario now accepts either and the test passes on 3.3.4 and 3.3.5 alike. --- requirements.txt | 2 +- .../driver/psycopg3/tests/test_encoding.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 104b76588e6..a2fdf15f3e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -53,7 +53,7 @@ libgravatar==1.0.* paramiko==3.5.1 psutil==7.2.* psycopg[c]==3.2.13; python_version < '3.10' -psycopg[c]==3.3.5; python_version >= '3.10' +psycopg[c]==3.3.4; python_version >= '3.10' pyotp==2.* python-dateutil==2.* pytz==2026.* diff --git a/web/pgadmin/utils/driver/psycopg3/tests/test_encoding.py b/web/pgadmin/utils/driver/psycopg3/tests/test_encoding.py index a07f600668b..47554408ce0 100644 --- a/web/pgadmin/utils/driver/psycopg3/tests/test_encoding.py +++ b/web/pgadmin/utils/driver/psycopg3/tests/test_encoding.py @@ -31,8 +31,13 @@ class TestEncoding(BaseTestGenerator): scenarios = [ ('UTF8 maps to the utf-8 python codec', dict(key='UTF8', expected=['utf-8', 'utf-8'])), + # psycopg >= 3.3.5 carries an ISO88591 alias in its encoding + # table, so inverting py_codecs resolves iso8859-1 to that name; + # <= 3.3.4 only has LATIN1. Both are valid PostgreSQL names for + # the same encoding, so accept either. ('LATIN1 maps to the iso8859-1 python codec', - dict(key='LATIN1', expected=['ISO88591', 'iso8859-1'])), + dict(key='LATIN1', expected=['ISO88591', 'iso8859-1'], + also_valid=['LATIN1', 'iso8859-1'])), ('SQL_ASCII falls back to the pgAdmin-only override', dict(key='SQL_ASCII', expected=['utf-8', 'utf-8'])), ('EUC_TW falls back to the pgAdmin-only override', @@ -43,6 +48,9 @@ class TestEncoding(BaseTestGenerator): dict(key='ascii', expected=['SQLASCII', 'raw-unicode-escape'])), ] + # Only set by scenarios where more than one result is correct. + also_valid = None + def setUp(self): # No DB connection needed for this test. pass @@ -52,7 +60,12 @@ def runTest(self): configure_driver_encodings(encodings) with self.app.app_context(): - self.assertEqual(get_encoding(self.key), self.expected) + result = get_encoding(self.key) + + if self.also_valid is None: + self.assertEqual(result, self.expected) + else: + self.assertIn(result, [self.expected, self.also_valid]) # py_codecs/pg_codecs must stay plain dicts and stay in sync, # regardless of how psycopg represents its internal encoding