From 0f32dbb4416a98bc878c8024f3b60d0ce3d8b96f Mon Sep 17 00:00:00 2001 From: Karl Velicka Date: Wed, 12 Nov 2025 16:30:04 +0000 Subject: [PATCH 1/5] Add 3.14 to github workflows, update cython to 3.2.2, and use it in tox.ini --- .github/workflows/test.yml | 5 ++++- tox.ini | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16d6a88f..0f213e47 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,6 +38,9 @@ jobs: - python-version: '3.13' toxenv: 'py313-test' + - python-version: '3.14' + toxenv: 'py314-test' + - python-version: 'pypy-3.11' toxenv: 'pypy3-test' @@ -65,7 +68,7 @@ jobs: pip install -U pip # so that we can use wheels # tox creates the sdist: we need cython to be installed in the env which # creates the sdist, to generate the .c files - pip install tox==4.25.0 cython==3.0.12 + pip install tox==4.25.0 cython==3.2.2 - name: Run tox run: tox -e ${{ matrix.toxenv }} diff --git a/tox.ini b/tox.ini index be29406b..ff3d9a38 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] # nopyx is a special env where Cython is NOT installed, and thus we run # pure-python tests -envlist = py37-test,py38-test,py39-test,py310-test,py311-test,py312-test,py313-test,pypy-{test,bench},pypy3-{test},docs +envlist = py37-test,py38-test,py39-test,py310-test,py311-test,py312-test,py313-test,py314-test,pypy-{test,bench},pypy3-{test},docs [testenv] setenv = From 4d5abcaa2adae6f611e1a8ab04c0878291f86cf0 Mon Sep 17 00:00:00 2001 From: David Lawson Date: Wed, 5 Nov 2025 11:18:39 +0000 Subject: [PATCH 2/5] Use Py_HashBuffer for 3.14+ --- capnpy/_hash.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/capnpy/_hash.h b/capnpy/_hash.h index 18f29f17..dcbda235 100644 --- a/capnpy/_hash.h +++ b/capnpy/_hash.h @@ -25,7 +25,13 @@ typedef struct { // Use values / methods from CPython 3.5 #define HASH_MASK _PyHASH_MODULUS + + // https://groups.google.com/g/cython-users/c/YQkU8oc8oSM/m/nVJ_IX8KAgAJ + #if PY_VERSION_HEX < 0x030E0000 #define strhash_f _Py_HashBytes + #else + #define strhash_f Py_HashBuffer + #endif // Unused in Python 3, but has to exist during cython compilation _Py_HashSecret_custom HashSecret; From 3a9c71996a35e5ca37c5eaa75f48bb677d958355 Mon Sep 17 00:00:00 2001 From: David Lawson Date: Thu, 20 Nov 2025 10:58:00 +0000 Subject: [PATCH 3/5] Use a newer pytest for Python 3.13/3.14 --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index ff3d9a38..ac894001 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,8 @@ setenv = TOX_ENV={envname} deps = - pytest==6.2.5 - #git+https://github.com/antocuni/pytest-benchmark.git#egg=pytest-benchmark + pytest==6.2.5 ; python_version < "3.13" + pytest>=8.4.0 ; python_version >= "3.13" commands = test: py.test {envsitepackagesdir}/capnpy/testing -rs --pyx {posargs} From 09f67c34c5b3fd3cb71346431b72b44f968dc71f Mon Sep 17 00:00:00 2001 From: Karl Velicka Date: Tue, 9 Dec 2025 11:39:03 +0000 Subject: [PATCH 4/5] test_standalone: adapt to newer versions of pytest --- capnpy/testing/compiler/test_standalone.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/capnpy/testing/compiler/test_standalone.py b/capnpy/testing/compiler/test_standalone.py index 7eb8ded3..459cddd0 100644 --- a/capnpy/testing/compiler/test_standalone.py +++ b/capnpy/testing/compiler/test_standalone.py @@ -12,6 +12,21 @@ def initargs(self, request, tmpdir, monkeypatch): monkeypatch.syspath_prepend(tmpdir) self.imports = [] + yield + + # As of pytest 7.4, the way teardowns work has changed, meaning that + # we we do not have the same order about when the teardown code is run. + # Putting the teardown stuff in the `initargs` fixture after a `yield` + # statement does lead to a corret execution order, and it should work + # for older versions of pytest too. + + # def teardown(self): + # remove the modules which we have imported for the test from + # sys.modules + for modname in self.imports: + del sys.modules[modname] + + def compile(self, filename, src): infile = self.write(filename, src.strip()) comp = StandaloneCompiler(sys.path) @@ -22,12 +37,6 @@ def import_(self, modname): self.imports.append(modname) return mod - def teardown(self): - # remove the modules which we have imported for the test from - # sys.modules - for modname in self.imports: - del sys.modules[modname] - def test_compile_and_import(self): self.compile("example.capnp", """ @0xbf5147cbbecf40c1; From 454b2d8512b1cfc1ce982062c814236c916732c7 Mon Sep 17 00:00:00 2001 From: Karl Velicka Date: Tue, 9 Dec 2025 11:47:35 +0000 Subject: [PATCH 5/5] tox: remove mentions of py37-test The environment itself was already removed in db36e46. --- Makefile | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b09db969..d396ca19 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,4 @@ schema: annotate # run only python3 tests: this should good enough to be checked # locally before pushing and run the whole tests on travis test: - tox -e py37-test,py38-test + tox -e py38-test diff --git a/tox.ini b/tox.ini index ac894001..4aa903c5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] # nopyx is a special env where Cython is NOT installed, and thus we run # pure-python tests -envlist = py37-test,py38-test,py39-test,py310-test,py311-test,py312-test,py313-test,py314-test,pypy-{test,bench},pypy3-{test},docs +envlist = py38-test,py39-test,py310-test,py311-test,py312-test,py313-test,py314-test,pypy-{test,bench},pypy3-{test},docs [testenv] setenv =