Skip to content

Commit 036a5ec

Browse files
committed
Ensure coverage still work on Cython 3.1+ and Python 3.13+
1 parent 8532651 commit 036a5ec

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[run]
2+
core = ctrace
23
plugins = Cython.Coverage
34
source = libzim

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,13 @@ def get_cython_extension() -> list[Extension]:
392392
compiler_directives = {"language_level": "3"}
393393

394394
if config.profiling:
395-
define_macros += [("CYTHON_TRACE", "1"), ("CYTHON_TRACE_NOGIL", "1")]
395+
define_macros += [
396+
("CYTHON_TRACE", "1"),
397+
("CYTHON_TRACE_NOGIL", "1"),
398+
# Disable sys.monitoring for Python 3.13+ to enable coverage.py support
399+
# coverage.py doesn't support sys.monitoring yet (Cython 3.1+ issue)
400+
("CYTHON_USE_SYS_MONITORING", "0"),
401+
]
396402
compiler_directives.update(linetrace="true")
397403

398404
include_dirs: list[str] = []

0 commit comments

Comments
 (0)