mirror of
https://github.com/python/cpython.git
synced 2024-11-21 21:09:37 +01:00
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:
parent
8477951a1c
commit
f0c6fccd08
@ -1,5 +1,6 @@
|
|||||||
# Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
|
# Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
|
||||||
from test import support
|
from test import support
|
||||||
|
from test.libregrtest.utils import get_build_info
|
||||||
from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS
|
from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -1780,8 +1781,10 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||||||
'perf_profiling': 2,
|
'perf_profiling': 2,
|
||||||
}
|
}
|
||||||
config_dev_mode(preconfig, config)
|
config_dev_mode(preconfig, config)
|
||||||
|
# Temporarily enable ignore_stderr=True to ignore warnings on JIT builds
|
||||||
|
# See gh-126255 for more information
|
||||||
self.check_all_configs("test_initconfig_api", config, preconfig,
|
self.check_all_configs("test_initconfig_api", config, preconfig,
|
||||||
api=API_ISOLATED)
|
api=API_ISOLATED, ignore_stderr=True)
|
||||||
|
|
||||||
def test_initconfig_get_api(self):
|
def test_initconfig_get_api(self):
|
||||||
self.run_embedded_interpreter("test_initconfig_get_api")
|
self.run_embedded_interpreter("test_initconfig_get_api")
|
||||||
|
@ -210,14 +210,14 @@ class TestPerfTrampoline(unittest.TestCase):
|
|||||||
sys.activate_stack_trampoline("perf")
|
sys.activate_stack_trampoline("perf")
|
||||||
sys.activate_stack_trampoline("perf")
|
sys.activate_stack_trampoline("perf")
|
||||||
"""
|
"""
|
||||||
assert_python_ok("-c", code)
|
assert_python_ok("-c", code, PYTHON_JIT="0")
|
||||||
|
|
||||||
def test_sys_api_with_invalid_trampoline(self):
|
def test_sys_api_with_invalid_trampoline(self):
|
||||||
code = """if 1:
|
code = """if 1:
|
||||||
import sys
|
import sys
|
||||||
sys.activate_stack_trampoline("invalid")
|
sys.activate_stack_trampoline("invalid")
|
||||||
"""
|
"""
|
||||||
rc, out, err = assert_python_failure("-c", code)
|
rc, out, err = assert_python_failure("-c", code, PYTHON_JIT="0")
|
||||||
self.assertIn("invalid backend: invalid", err.decode())
|
self.assertIn("invalid backend: invalid", err.decode())
|
||||||
|
|
||||||
def test_sys_api_get_status(self):
|
def test_sys_api_get_status(self):
|
||||||
@ -228,7 +228,7 @@ class TestPerfTrampoline(unittest.TestCase):
|
|||||||
sys.deactivate_stack_trampoline()
|
sys.deactivate_stack_trampoline()
|
||||||
assert sys.is_stack_trampoline_active() is False
|
assert sys.is_stack_trampoline_active() is False
|
||||||
"""
|
"""
|
||||||
assert_python_ok("-c", code)
|
assert_python_ok("-c", code, PYTHON_JIT="0")
|
||||||
|
|
||||||
|
|
||||||
def is_unwinding_reliable_with_frame_pointers():
|
def is_unwinding_reliable_with_frame_pointers():
|
||||||
|
@ -1310,12 +1310,17 @@ init_interp_main(PyThreadState *tstate)
|
|||||||
enabled = *env != '0';
|
enabled = *env != '0';
|
||||||
}
|
}
|
||||||
if (enabled) {
|
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) {
|
if (config->perf_profiling > 0) {
|
||||||
(void)PyErr_WarnEx(
|
(void)PyErr_WarnEx(
|
||||||
PyExc_RuntimeWarning,
|
PyExc_RuntimeWarning,
|
||||||
"JIT deactivated as perf profiling support is active",
|
"JIT deactivated as perf profiling support is active",
|
||||||
0);
|
0);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
PyObject *opt = _PyOptimizer_NewUOpOptimizer();
|
PyObject *opt = _PyOptimizer_NewUOpOptimizer();
|
||||||
if (opt == NULL) {
|
if (opt == NULL) {
|
||||||
return _PyStatus_ERR("can't initialize optimizer");
|
return _PyStatus_ERR("can't initialize optimizer");
|
||||||
|
@ -2290,6 +2290,7 @@ sys_activate_stack_trampoline_impl(PyObject *module, const char *backend)
|
|||||||
#ifdef _Py_JIT
|
#ifdef _Py_JIT
|
||||||
_PyOptimizerObject* optimizer = _Py_GetOptimizer();
|
_PyOptimizerObject* optimizer = _Py_GetOptimizer();
|
||||||
if (optimizer != NULL) {
|
if (optimizer != NULL) {
|
||||||
|
Py_DECREF(optimizer);
|
||||||
PyErr_SetString(PyExc_ValueError, "Cannot activate the perf trampoline if the JIT is active");
|
PyErr_SetString(PyExc_ValueError, "Cannot activate the perf trampoline if the JIT is active");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user