From 7fc9868b9d8aca119f1fe31c93102b32700dade5 Mon Sep 17 00:00:00 2001 From: Alexander Jaust <18347253+ajaust@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:35:38 +0100 Subject: [PATCH 1/2] Update RefTrace's garbage collection Python 3.14 changed how object reference counts work [1], often resulting in lower counts than before. In RefTrace, this reduces the internal trace reference count from 3 to 2 for objects that may be garbage collected. [1]: https://docs.python.org/3/whatsnew/3.14.html#optimizations --- python/segyio/trace.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/segyio/trace.py b/python/segyio/trace.py index 9c378af7..4d92afc8 100644 --- a/python/segyio/trace.py +++ b/python/segyio/trace.py @@ -435,8 +435,14 @@ def flush(self): be useful in certain contexts to provide stronger guarantees. """ garbage = [] + # If there are no external references to the data (so only internal + # references remain), the reference count is + # - 2 (Python >= 3.14) + # - 3 (Python < 3.14) + garbage_threshold = 3 if sys.version_info < (3, 14) else 2 + for i, (x, signature) in self.refs.items(): - if sys.getrefcount(x) == 3: + if sys.getrefcount(x) == garbage_threshold: garbage.append(i) if fingerprint(x) == signature: continue From 252acc4c604a1f87306e27cabfa09502ae4d5858 Mon Sep 17 00:00:00 2001 From: Alexander Jaust <18347253+ajaust@users.noreply.github.com> Date: Mon, 17 Nov 2025 07:19:36 +0100 Subject: [PATCH 2/2] Enable Python 3.14 build --- .github/workflows/wheels.yaml | 2 +- python/pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index e9deb1b8..79173023 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -53,7 +53,7 @@ jobs: CIBW_ENVIRONMENT_WINDOWS: > CMAKE_GENERATOR="${{ matrix.cmake_generator }}" CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}" - CIBW_SKIP: cp38-* cp314* *-musllinux_* + CIBW_SKIP: cp38-* *-musllinux_* CIBW_ARCHS: ${{ matrix.arch }} run: | python -m cibuildwheel --output-dir wheelhouse python/ diff --git a/python/pyproject.toml b/python/pyproject.toml index d755154c..d3de9f62 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -71,6 +71,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development :: Libraries",