summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-02-13 21:56:49 (GMT)
committerGitHub <noreply@github.com>2024-02-13 21:56:49 (GMT)
commit514b1c91b8651e8ab9129a34b7482033d2fd4e5b (patch)
tree11a091856f2b7f3ec65009b5b9de4e424a2a79bc /Include/internal/pycore_code.h
parent206f73dc5f1b4c3c81119808aa7fd9038661cf90 (diff)
downloadcpython-514b1c91b8651e8ab9129a34b7482033d2fd4e5b.zip
cpython-514b1c91b8651e8ab9129a34b7482033d2fd4e5b.tar.gz
cpython-514b1c91b8651e8ab9129a34b7482033d2fd4e5b.tar.bz2
gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424)
For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12. A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index fdd5918..8553616 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -8,6 +8,15 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif
+
+// We hide some of the newer PyCodeObject fields behind macros.
+// This helps with backporting certain changes to 3.12.
+#define _PyCode_HAS_EXECUTORS(CODE) \
+ (CODE->co_executors != NULL)
+#define _PyCode_HAS_INSTRUMENTATION(CODE) \
+ (CODE->_co_instrumentation_version > 0)
+
+
#define CODE_MAX_WATCHERS 8
/* PEP 659