diff options
author | Mark Shannon <mark@hotpy.org> | 2023-06-19 09:32:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 09:32:20 (GMT) |
commit | 581619941ecce986a2fc8cbddd95256daa25fb26 (patch) | |
tree | 4531fd801297edeed79d2ce6dcba28117ff9dafc /Modules | |
parent | 4426279a4399158027a1145cff1c4c92424bf5b5 (diff) | |
download | cpython-581619941ecce986a2fc8cbddd95256daa25fb26.zip cpython-581619941ecce986a2fc8cbddd95256daa25fb26.tar.gz cpython-581619941ecce986a2fc8cbddd95256daa25fb26.tar.bz2 |
GH-104584: Assorted fixes for the optimizer API. (GH-105683)
* Add test for long loops
* Clear ENTER_EXECUTOR when deopting code objects.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testinternalcapi.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 3de32a3..0a3b0dd 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -840,6 +840,15 @@ set_optimizer(PyObject *self, PyObject *opt) Py_RETURN_NONE; } +static PyObject * +get_optimizer(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *opt = (PyObject *)PyUnstable_GetOptimizer(); + if (opt == NULL) { + Py_RETURN_NONE; + } + return opt; +} static int _pending_callback(void *arg) { @@ -982,6 +991,7 @@ static PyMethodDef module_functions[] = { {"iframe_getcode", iframe_getcode, METH_O, NULL}, {"iframe_getline", iframe_getline, METH_O, NULL}, {"iframe_getlasti", iframe_getlasti, METH_O, NULL}, + {"get_optimizer", get_optimizer, METH_NOARGS, NULL}, {"set_optimizer", set_optimizer, METH_O, NULL}, {"get_counter_optimizer", get_counter_optimizer, METH_NOARGS, NULL}, {"pending_threadfunc", _PyCFunction_CAST(pending_threadfunc), |