gh-124855: Don't allow the JIT and perf support to be active at the same time (#124856)
This commit is contained in:
committed by
GitHub
parent
2d9d10179f
commit
2d37c719ed
@@ -1310,14 +1310,21 @@ init_interp_main(PyThreadState *tstate)
|
||||
enabled = *env != '0';
|
||||
}
|
||||
if (enabled) {
|
||||
PyObject *opt = _PyOptimizer_NewUOpOptimizer();
|
||||
if (opt == NULL) {
|
||||
return _PyStatus_ERR("can't initialize optimizer");
|
||||
if (config->perf_profiling > 0) {
|
||||
(void)PyErr_WarnEx(
|
||||
PyExc_RuntimeWarning,
|
||||
"JIT deactivated as perf profiling support is active",
|
||||
0);
|
||||
} else {
|
||||
PyObject *opt = _PyOptimizer_NewUOpOptimizer();
|
||||
if (opt == NULL) {
|
||||
return _PyStatus_ERR("can't initialize optimizer");
|
||||
}
|
||||
if (_Py_SetTier2Optimizer((_PyOptimizerObject *)opt)) {
|
||||
return _PyStatus_ERR("can't install optimizer");
|
||||
}
|
||||
Py_DECREF(opt);
|
||||
}
|
||||
if (_Py_SetTier2Optimizer((_PyOptimizerObject *)opt)) {
|
||||
return _PyStatus_ERR("can't install optimizer");
|
||||
}
|
||||
Py_DECREF(opt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user