mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
GH-104584: Assorted fixes for the optimizer API. (GH-105683)
* Add test for long loops * Clear ENTER_EXECUTOR when deopting code objects.
This commit is contained in:
parent
4426279a43
commit
581619941e
6 changed files with 298 additions and 204 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue