Use python 3.14 environment in GitHub workflows#2922
Merged
Conversation
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev3=py314h509198e_13 ran successfully. |
antonwolfy
marked this pull request as ready for review
May 18, 2026 13:18
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
May 18, 2026 13:19
vlad-perevezentsev
approved these changes
May 19, 2026
vlad-perevezentsev
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thank you @antonwolfy
antonwolfy
force-pushed
the
use-py3.14-in-gh-workflows
branch
from
July 9, 2026 11:32
60bde39 to
cded1c6
Compare
vlad-perevezentsev
approved these changes
Jul 16, 2026
vlad-perevezentsev
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thank you @antonwolfy
github-actions Bot
added a commit
that referenced
this pull request
Jul 20, 2026
This PR updates the remaining GitHub workflows and conda environments to run under python 3.14, and bumps coveralls to 4.1.0 (which supports 3.14). ### Version bumps (3.13/3.12 → 3.14) - `check-onemath.yaml` — oneMath interface tests - `conda-package.yml` — array API conformance tests (`python-ver`) - `environments/building_docs.yml` — docs build - `environments/upload_cleanup_conda_pkg.yml` — conda package upload/cleanup - `environments/coverage.yml` — coverage job (was pinned to `3.12`) ### Coverage job fixes for python 3.14 Bumping the coverage environment from 3.12 to 3.14 surfaced two failures unrelated to dpnp's runtime code — both stem from how coverage instrumentation interacts with 3.14's `sys.monitoring`: **1. Build failure — `undeclared identifier '__Pyx_MonitoringEventTypes_CyGen_count'`** Coverage builds compile every extension with `CYTHON_TRACE=1` (`DPNP_GENERATE_COVERAGE=ON`), but Cython line tracing also needs the matching `# cython: linetrace=True` directive at cythonize time. Three `.pyx` files were missing it (`_slicing.pyx`, `_stride_utils.pyx`, `_types.pyx`): without the directive, Cython references `__Pyx_MonitoringEventTypes_CyGen_count` (from the shared generator/coroutine struct) but never defines it. On python ≤3.12 the guarding `CYTHON_USE_SYS_MONITORING` macro is `0`, so the code was unreachable — which is why the previous `3.12` pin hid this; on 3.13+ it becomes reachable and fails to compile. Added the directive to the three files. As a side effect, these files were previously producing no line-coverage data and are now measured. **2. Test failures — `test_dlpack.py::TestDLPack::test_invaid_stream[scalar|dictionary|device]`** coverage.py 7.9+ makes the `sys.monitoring` core (`sysmon`) the default on python 3.14. That core (a) does not support plugins such as the `Cython.Coverage` plugin used here, and (b) corrupts the pending exception when a C/Cython function raises — turning dpctl's correct `TypeError` from `usm_ndarray.__dlpack__` into a `SystemError`, so `assert_raises(TypeError, ...)` fails. Pinned the measurement core back to `ctrace` via `core = "ctrace"` in `[tool.coverage.run]` (`pyproject.toml`). `ctrace` supports both the Cython plugin and branch coverage, so no coverage data is lost. 3a91802
7 tasks
antonwolfy
added a commit
that referenced
this pull request
Jul 22, 2026
The GutHub coverage workflow started hanging right after the coverage environment was bumped from Python 3.12 to 3.14 (#2922). This PR fixes the hang by compiling the coverage build with `CYTHON_USE_SYS_MONITORING=0`, forcing Cython to use its legacy `settrace`-based line tracing instead of the `sys.monitoring` path that becomes the default on Python 3.13+. ### Root cause Coverage builds compile every Cython extension with line tracing (`CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1` + `# cython: linetrace=True`). On Python 3.13+, Cython gates its tracing implementation on `CYTHON_USE_SYS_MONITORING` (`PY_VERSION_HEX >= 0x030d00B1`) and emits `sys.monitoring` hooks directly into the compiled `.so`. Those hooks fire exception/unwind events (`PyMonitoring_FireRaiseEvent`, `PyMonitoring_FirePyUnwindEvent`, ...) **without preserving the in-flight exception** — unlike the legacy path (`__Pyx_call_line_trace_func`), which brackets the trace call with `PyErr_Fetch`/`PyErr_Restore`. When an exception propagates out of an instrumented `.pyx` frame, this corrupts the interpreter's error state: the correct exception is turned into a `SystemError` ("returned a result with an exception set"), and the process then hangs. This is an upstream Cython bug: cython/cython#6658 (open, same failure mode — Cython + coverage + Python 3.13 `sys.monitoring` → `SystemError` and hang). The first test to trigger this is `test_dlpack.py::TestDLPack::test_invaid_stream`, which does `assert_raises(TypeError, x.__dlpack__, stream=<invalid>)`. The `TypeError` is raised in the instrumented `dpnp/tensor/_usmarray.pyx` (`_validate_and_use_stream`) and unwinds out through `usm_ndarray.__dlpack__`, hitting the corruption. #### Why not just rely on `core = "ctrace"`? PR #2922 added `core = "ctrace"` in `pyproject.toml` to keep **coverage.py** off the `sysmon` measurement core (needed for the `Cython.Coverage` plugin). That is still required and unchanged. But it only controls coverage.py's own tracer — the corruption here comes from **Cython's compiled-in** `sys.monitoring` instrumentation, which is gated purely on the Python version and independent of coverage.py's core choice. `CYTHON_USE_SYS_MONITORING=0` addresses that side; the two settings are complementary.
github-actions Bot
added a commit
that referenced
this pull request
Jul 22, 2026
The GutHub coverage workflow started hanging right after the coverage environment was bumped from Python 3.12 to 3.14 (#2922). This PR fixes the hang by compiling the coverage build with `CYTHON_USE_SYS_MONITORING=0`, forcing Cython to use its legacy `settrace`-based line tracing instead of the `sys.monitoring` path that becomes the default on Python 3.13+. ### Root cause Coverage builds compile every Cython extension with line tracing (`CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1` + `# cython: linetrace=True`). On Python 3.13+, Cython gates its tracing implementation on `CYTHON_USE_SYS_MONITORING` (`PY_VERSION_HEX >= 0x030d00B1`) and emits `sys.monitoring` hooks directly into the compiled `.so`. Those hooks fire exception/unwind events (`PyMonitoring_FireRaiseEvent`, `PyMonitoring_FirePyUnwindEvent`, ...) **without preserving the in-flight exception** — unlike the legacy path (`__Pyx_call_line_trace_func`), which brackets the trace call with `PyErr_Fetch`/`PyErr_Restore`. When an exception propagates out of an instrumented `.pyx` frame, this corrupts the interpreter's error state: the correct exception is turned into a `SystemError` ("returned a result with an exception set"), and the process then hangs. This is an upstream Cython bug: cython/cython#6658 (open, same failure mode — Cython + coverage + Python 3.13 `sys.monitoring` → `SystemError` and hang). The first test to trigger this is `test_dlpack.py::TestDLPack::test_invaid_stream`, which does `assert_raises(TypeError, x.__dlpack__, stream=<invalid>)`. The `TypeError` is raised in the instrumented `dpnp/tensor/_usmarray.pyx` (`_validate_and_use_stream`) and unwinds out through `usm_ndarray.__dlpack__`, hitting the corruption. #### Why not just rely on `core = "ctrace"`? PR #2922 added `core = "ctrace"` in `pyproject.toml` to keep **coverage.py** off the `sysmon` measurement core (needed for the `Cython.Coverage` plugin). That is still required and unchanged. But it only controls coverage.py's own tracer — the corruption here comes from **Cython's compiled-in** `sys.monitoring` instrumentation, which is gated purely on the Python version and independent of coverage.py's core choice. `CYTHON_USE_SYS_MONITORING=0` addresses that side; the two settings are complementary. 987f299
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the remaining GitHub workflows and conda environments to run under python 3.14, and bumps coveralls to 4.1.0 (which supports 3.14).
Version bumps (3.13/3.12 → 3.14)
check-onemath.yaml— oneMath interface testsconda-package.yml— array API conformance tests (python-ver)environments/building_docs.yml— docs buildenvironments/upload_cleanup_conda_pkg.yml— conda package upload/cleanupenvironments/coverage.yml— coverage job (was pinned to3.12)Coverage job fixes for python 3.14
Bumping the coverage environment from 3.12 to 3.14 surfaced two failures unrelated to dpnp's runtime code — both stem from how coverage instrumentation interacts with 3.14's
sys.monitoring:1. Build failure —
undeclared identifier '__Pyx_MonitoringEventTypes_CyGen_count'Coverage builds compile every extension with
CYTHON_TRACE=1(DPNP_GENERATE_COVERAGE=ON), but Cython line tracing also needs the matching# cython: linetrace=Truedirective at cythonize time. Three.pyxfiles were missing it (_slicing.pyx,_stride_utils.pyx,_types.pyx): without the directive, Cython references__Pyx_MonitoringEventTypes_CyGen_count(from the shared generator/coroutine struct) but never defines it. On python ≤3.12 the guardingCYTHON_USE_SYS_MONITORINGmacro is0, so the code was unreachable — which is why the previous3.12pin hid this; on 3.13+ it becomes reachable and fails to compile. Added the directive to the three files. As a side effect, these files were previously producing no line-coverage data and are now measured.2. Test failures —
test_dlpack.py::TestDLPack::test_invaid_stream[scalar|dictionary|device]coverage.py 7.9+ makes the
sys.monitoringcore (sysmon) the default on python 3.14. That core (a) does not support plugins such as theCython.Coverageplugin used here, and (b) corrupts the pending exception when a C/Cython function raises — turning dpctl's correctTypeErrorfromusm_ndarray.__dlpack__into aSystemError, soassert_raises(TypeError, ...)fails. Pinned the measurement core back toctraceviacore = "ctrace"in[tool.coverage.run](pyproject.toml).ctracesupports both the Cython plugin and branch coverage, so no coverage data is lost.