gh-126255: Ignore warning about JIT being deactivated when perf support is active in test_embed.InitConfigTests.test_initconfig_api (#126302)

Temporarily ignore warnings about JIT deactivation when perf support is active. 
This will be reverted as soon as a way is found to determine at run time whether the interpreter was built with JIT. Currently, this is not possible on Windows.


Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
mpage 2024-11-01 16:10:58 -07:00 committed by GitHub
parent 8477951a1c
commit f0c6fccd08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 5 deletions

View file

@ -1310,12 +1310,17 @@ init_interp_main(PyThreadState *tstate)
enabled = *env != '0';
}
if (enabled) {
#ifdef _Py_JIT
// perf profiler works fine with tier 2 interpreter, so
// only checking for a "real JIT".
if (config->perf_profiling > 0) {
(void)PyErr_WarnEx(
PyExc_RuntimeWarning,
"JIT deactivated as perf profiling support is active",
0);
} else {
} else
#endif
{
PyObject *opt = _PyOptimizer_NewUOpOptimizer();
if (opt == NULL) {
return _PyStatus_ERR("can't initialize optimizer");

View file

@ -2290,6 +2290,7 @@ sys_activate_stack_trampoline_impl(PyObject *module, const char *backend)
#ifdef _Py_JIT
_PyOptimizerObject* optimizer = _Py_GetOptimizer();
if (optimizer != NULL) {
Py_DECREF(optimizer);
PyErr_SetString(PyExc_ValueError, "Cannot activate the perf trampoline if the JIT is active");
return NULL;
}