summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-10 07:39:07 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-11-10 14:49:15 -0500
commit59e29586615fe6445b9f5ab418f9635d7d754259 (patch)
treed73362ab9ad9e7c791765fdbbc1bad36864bc13c /coverage
parentdfa97742b62f83b5c892e5de78a3ef1a97ee8a27 (diff)
downloadpython-coveragepy-git-nedbat/py3.11.tar.gz
fix: make this work on CPython 3.11 #1241nedbat/py3.11
The fix for CTracer is egregious and will need to be updated when there's a supported way to do it. The fullcoverage skip is noted in https://github.com/nedbat/coveragepy/issues/1278 The raise_through_with skip is noted in https://github.com/nedbat/coveragepy/issues/1270
Diffstat (limited to 'coverage')
-rw-r--r--coverage/ctracer/util.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/coverage/ctracer/util.h b/coverage/ctracer/util.h
index ff139329..58fa1d49 100644
--- a/coverage/ctracer/util.h
+++ b/coverage/ctracer/util.h
@@ -12,9 +12,15 @@
#undef COLLECT_STATS /* Collect counters: stats are printed when tracer is stopped. */
#undef DO_NOTHING /* Define this to make the tracer do nothing. */
+#if PY_VERSION_HEX >= 0x030B00A0
+// 3.11 moved f_lasti into an internal structure. This is totally the wrong way
+// to make this work, but it's all I've got until https://bugs.python.org/issue40421
+// is resolved.
+#include <internal/pycore_frame.h>
+#define MyFrame_lasti(f) ((f)->f_frame->f_lasti * 2)
+#elif PY_VERSION_HEX >= 0x030A00A7
// The f_lasti field changed meaning in 3.10.0a7. It had been bytes, but
// now is instructions, so we need to adjust it to use it as a byte index.
-#if PY_VERSION_HEX >= 0x030A00A7
#define MyFrame_lasti(f) ((f)->f_lasti * 2)
#else
#define MyFrame_lasti(f) ((f)->f_lasti)