summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-06-26 13:35:19 (GMT)
committerGitHub <noreply@github.com>2024-06-26 13:35:19 (GMT)
commite26e0985d94f1b9812cf41f043df89185f247945 (patch)
tree822ec897f9914e88f83e7d2821bcb0d45ce2a275 /Modules
parent6bc7e2cca546c11e2b807068a4a612d0d902da11 (diff)
downloadcpython-e26e0985d94f1b9812cf41f043df89185f247945.zip
cpython-e26e0985d94f1b9812cf41f043df89185f247945.tar.gz
cpython-e26e0985d94f1b9812cf41f043df89185f247945.tar.bz2
[3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043)
gh-120642: Move private PyCode APIs to the internal C API (#120643) * Move _Py_CODEUNIT and related functions to pycore_code.h. * Move _Py_BackoffCounter to pycore_backoff.h. * Move Include/cpython/optimizer.h content to pycore_optimizer.h. * Remove Include/cpython/optimizer.h. * Remove PyUnstable_Replace_Executor(). Rename functions: * PyUnstable_GetExecutor() => _Py_GetExecutor() * PyUnstable_GetOptimizer() => _Py_GetOptimizer() * PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer() * PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter() * PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer() (cherry picked from commit 9e4a81f00fef689c6e18a64245aa064eaadc7ac7)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_opcode.c9
-rw-r--r--Modules/_testinternalcapi.c8
2 files changed, 9 insertions, 8 deletions
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index cc72cb1..4bf6393 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -5,9 +5,10 @@
#include "Python.h"
#include "compile.h"
#include "opcode.h"
-#include "internal/pycore_code.h"
-#include "internal/pycore_compile.h"
-#include "internal/pycore_intrinsics.h"
+#include "pycore_code.h"
+#include "pycore_compile.h"
+#include "pycore_intrinsics.h"
+#include "pycore_optimizer.h" // _Py_GetExecutor()
/*[clinic input]
module _opcode
@@ -368,7 +369,7 @@ _opcode_get_executor_impl(PyObject *module, PyObject *code, int offset)
return NULL;
}
#ifdef _Py_TIER2
- return (PyObject *)PyUnstable_GetExecutor((PyCodeObject *)code, offset);
+ return (PyObject *)_Py_GetExecutor((PyCodeObject *)code, offset);
#else
PyErr_Format(PyExc_RuntimeError,
"Executors are not available in this build");
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index 8c65b80..5055bca 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -990,13 +990,13 @@ get_co_framesize(PyObject *self, PyObject *arg)
static PyObject *
new_counter_optimizer(PyObject *self, PyObject *arg)
{
- return PyUnstable_Optimizer_NewCounter();
+ return _PyOptimizer_NewCounter();
}
static PyObject *
new_uop_optimizer(PyObject *self, PyObject *arg)
{
- return PyUnstable_Optimizer_NewUOpOptimizer();
+ return _PyOptimizer_NewUOpOptimizer();
}
static PyObject *
@@ -1005,7 +1005,7 @@ set_optimizer(PyObject *self, PyObject *opt)
if (opt == Py_None) {
opt = NULL;
}
- if (PyUnstable_SetOptimizer((_PyOptimizerObject*)opt) < 0) {
+ if (_Py_SetTier2Optimizer((_PyOptimizerObject*)opt) < 0) {
return NULL;
}
Py_RETURN_NONE;
@@ -1016,7 +1016,7 @@ get_optimizer(PyObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *opt = NULL;
#ifdef _Py_TIER2
- opt = (PyObject *)PyUnstable_GetOptimizer();
+ opt = (PyObject *)_Py_GetOptimizer();
#endif
if (opt == NULL) {
Py_RETURN_NONE;