https://github.com/python/cpython/commit/8b5431367042672d5c6f83e8329e199b79aa02f9
commit: 8b5431367042672d5c6f83e8329e199b79aa02f9
branch: main
author: Donghee Na <[email protected]>
committer: corona10 <[email protected]>
date: 2026-03-05T09:07:47+09:00
summary:

gh-144991: Use runtime JIT threshold in _testinternalcapi (gh-145496)

files:
M Include/internal/pycore_interp_structs.h
M Modules/_testinternalcapi.c

diff --git a/Include/internal/pycore_interp_structs.h 
b/Include/internal/pycore_interp_structs.h
index 1e69c64bcd1fc0..776fb9575c2365 100644
--- a/Include/internal/pycore_interp_structs.h
+++ b/Include/internal/pycore_interp_structs.h
@@ -496,7 +496,7 @@ struct _py_func_state {
 
 /* For now we hard-code this to a value for which we are confident
    all the static builtin types will fit (for all builds). */
-#define _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES 201
+#define _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES 202
 #define _Py_MAX_MANAGED_STATIC_EXT_TYPES 10
 #define _Py_MAX_MANAGED_STATIC_TYPES \
     (_Py_MAX_MANAGED_STATIC_BUILTIN_TYPES + _Py_MAX_MANAGED_STATIC_EXT_TYPES)
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index 998bf5e592e8ee..b6ed0b8902354e 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -2970,6 +2970,8 @@ static PyMethodDef module_functions[] = {
 static int
 module_exec(PyObject *module)
 {
+    PyInterpreterState *interp = PyInterpreterState_Get();
+
     if (_PyTestInternalCapi_Init_Lock(module) < 0) {
         return 1;
     }
@@ -3011,9 +3013,10 @@ module_exec(PyObject *module)
         return 1;
     }
 
+    // + 1 more due to one loop spent on tracing.
+    unsigned long threshold = interp->opt_config.jump_backward_initial_value + 
2;
     if (PyModule_Add(module, "TIER2_THRESHOLD",
-        // + 1 more due to one loop spent on tracing.
-                        PyLong_FromLong(JUMP_BACKWARD_INITIAL_VALUE + 2)) < 0) 
{
+                        PyLong_FromUnsignedLong(threshold)) < 0) {
         return 1;
     }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to