From 9765493020e6292599e272978a25935dd4d0fa88 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 10 Nov 2021 07:39:07 -0500 Subject: fix: CPython 3.11 support. #1241 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 --- coverage/ctracer/util.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'coverage') 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 +#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) -- cgit v1.2.1