Skip to content

Commit 6c664cf

Browse files
committed
Fix Verify Builds broken by Cython 3.3.0 pyzmq incompatibility
Cython 3.3.0 (released 2026-08-22) tightened pure-Python-mode name-conflict detection and rejects pyzmq's `hint: pointer(_zhint) = cast(...)` in zmq/backend/cython/_zmq.py with "'hint' redeclared". This breaks pip-installing pyzmq <=26.4.0 from source, since pyzmq's isolated build env resolves cython>=3.0.0 to the newest available. Fixed upstream in pyzmq 27.x. - Add pyzmq 27.2.0 to test_pip_install_pyzmq to cover the current latest-pyzmq + latest-Cython combination. - Set PIP_CONSTRAINT=cython<3.3 on the older pyzmq parametrize cells (23.2.0, 25.1.2, 26.2.0, 26.4.0) so their isolated build env picks Cython 3.2.9 and still compiles. Set AFTER the `env = os.environ.copy()` reset later in the function so it survives to the pyzmq install subprocess. - Same constraint on test_pip_install_salt_w_static_requirements and test_pip_install_salt_w_package_requirements: Salt 3006.x's requirements pin pyzmq 26.4.0, which we can't change, so the transitive build otherwise fails. - Xfail pyzmq 27.2.0 on Windows: --no-binary=:all: forces the isolated build env to build Cython 3.3.0 from source too, and MSVC hits "fatal error C1083: Cannot open compiler generated file: '': Invalid argument" when pip's isolated tempdir path exceeds Windows' effective path limit.
1 parent aaa99ac commit 6c664cf

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎tests/test_verify_build.py‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ def test_pip_install_salt_w_static_requirements(pipexec, pyexec, build, tmp_path
302302
env = os.environ.copy()
303303
env["RELENV_BUILDENV"] = "yes"
304304
env["USE_STATIC_REQUIREMENTS"] = "1"
305+
# Salt 3006.x's static requirements pin pyzmq 26.4.0, whose isolated build
306+
# env pulls cython>=3.0.0 -> resolves to 3.3.0 (2026-08-22), which then
307+
# rejects zmq/backend/cython/_zmq.py with "'hint' redeclared". Constrain
308+
# build-time Cython below 3.3 so the transitive pyzmq build succeeds.
309+
constraint = tmp_path / "cython-constraint.txt"
310+
constraint.write_text("cython<3.3\n")
311+
env["PIP_CONSTRAINT"] = str(constraint)
305312
p = subprocess.run(
306313
[
307314
"git",
@@ -360,6 +367,12 @@ def test_pip_install_salt_w_package_requirements(pipexec, pyexec, tmp_path, salt
360367
_setup_buildenv(pyexec, env)
361368
env["RELENV_BUILDENV"] = "yes"
362369
env["USE_STATIC_REQUIREMENTS"] = "1"
370+
# See test_pip_install_salt_w_static_requirements: Salt 3006.x's package
371+
# requirements pin pyzmq 26.4.0, which fails to build under Cython 3.3.0
372+
# ("'hint' redeclared"). Constrain build-time Cython to <3.3.
373+
constraint = tmp_path / "cython-constraint.txt"
374+
constraint.write_text("cython<3.3\n")
375+
env["PIP_CONSTRAINT"] = str(constraint)
363376
p = subprocess.run(
364377
[
365378
"git",
@@ -430,6 +443,7 @@ def test_pip_install_salt_w_package_requirements(pipexec, pyexec, tmp_path, salt
430443
"25.1.2",
431444
"26.2.0",
432445
"26.4.0",
446+
"27.2.0",
433447
],
434448
)
435449
def test_pip_install_pyzmq(
@@ -482,6 +496,14 @@ def test_pip_install_pyzmq(
482496
if pyzmq_version == "26.4.0" and sys.platform == "win32":
483497
pytest.xfail("Needs troubleshooting 4/12/25")
484498

499+
if pyzmq_version == "27.2.0" and sys.platform == "win32":
500+
# ``--no-binary=:all:`` (below) forces the isolated build env to build
501+
# Cython 3.3.0 from source too. MSVC hits ``fatal error C1083: Cannot
502+
# open compiler generated file: '': Invalid argument`` when the
503+
# object-file path under the isolated tempdir exceeds Windows' effective
504+
# path limit. Skip until we teach the test to allow a Cython wheel.
505+
pytest.xfail("Cython source build fails under MSVC (path length)")
506+
485507
_install_ppbt(pyexec)
486508

487509
env = os.environ.copy()
@@ -501,6 +523,19 @@ def test_pip_install_pyzmq(
501523
if pyzmq_version == "26.2.0" and sys.platform == "darwin":
502524
env["CFLAGS"] = f"{env.get('CFLAGS', '')} -DCMAKE_OSX_ARCHITECTURES='arm64' -DZMQ_HAVE_CURVE=0"
503525
env = os.environ.copy()
526+
527+
if pyzmq_version in ("23.2.0", "25.1.2", "26.2.0", "26.4.0"):
528+
# pyzmq <27 declares cython>=3.0.0 in build-system.requires. Cython 3.3.0
529+
# (2026-08-22) tightened pure-Python-mode name-conflict detection and
530+
# rejects `hint: pointer(_zhint) = cast(...)` in zmq/backend/cython/_zmq.py
531+
# with "'hint' redeclared". Fixed upstream in pyzmq 27.x. Constrain the
532+
# isolated build env's Cython so the old-pyzmq builds still compile.
533+
# NOTE: set this AFTER the ``env = os.environ.copy()`` reset above,
534+
# otherwise the reset wipes it before the pyzmq install subprocess runs.
535+
constraint = tmp_path / "cython-constraint.txt"
536+
constraint.write_text("cython<3.3\n")
537+
env["PIP_CONSTRAINT"] = str(constraint)
538+
504539
if sys.platform == "linux":
505540
p = subprocess.run(
506541
[

0 commit comments

Comments
 (0)