mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
[3.14] gh-141579: Fix perf_jit backend in sys.activate_stack_trampoline() (GH-141580) (#141581)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
d582b6f1ab
commit
17e7aad5e3
3 changed files with 28 additions and 8 deletions
|
|
@ -231,6 +231,24 @@ class TestPerfTrampoline(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
assert_python_ok("-c", code, PYTHON_JIT="0")
|
assert_python_ok("-c", code, PYTHON_JIT="0")
|
||||||
|
|
||||||
|
def test_sys_api_perf_jit_backend(self):
|
||||||
|
code = """if 1:
|
||||||
|
import sys
|
||||||
|
sys.activate_stack_trampoline("perf_jit")
|
||||||
|
assert sys.is_stack_trampoline_active() is True
|
||||||
|
sys.deactivate_stack_trampoline()
|
||||||
|
assert sys.is_stack_trampoline_active() is False
|
||||||
|
"""
|
||||||
|
assert_python_ok("-c", code, PYTHON_JIT="0")
|
||||||
|
|
||||||
|
def test_sys_api_with_existing_perf_jit_trampoline(self):
|
||||||
|
code = """if 1:
|
||||||
|
import sys
|
||||||
|
sys.activate_stack_trampoline("perf_jit")
|
||||||
|
sys.activate_stack_trampoline("perf_jit")
|
||||||
|
"""
|
||||||
|
assert_python_ok("-c", code, PYTHON_JIT="0")
|
||||||
|
|
||||||
|
|
||||||
def is_unwinding_reliable_with_frame_pointers():
|
def is_unwinding_reliable_with_frame_pointers():
|
||||||
cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
|
cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix :func:`sys.activate_stack_trampoline` to properly support the
|
||||||
|
``perf_jit`` backend. Patch by Pablo Galindo.
|
||||||
|
|
@ -2373,6 +2373,7 @@ sys_activate_stack_trampoline_impl(PyObject *module, const char *backend)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (strcmp(backend, "perf_jit") == 0) {
|
else if (strcmp(backend, "perf_jit") == 0) {
|
||||||
_PyPerf_Callbacks cur_cb;
|
_PyPerf_Callbacks cur_cb;
|
||||||
_PyPerfTrampoline_GetCallbacks(&cur_cb);
|
_PyPerfTrampoline_GetCallbacks(&cur_cb);
|
||||||
|
|
@ -2383,7 +2384,6 @@ sys_activate_stack_trampoline_impl(PyObject *module, const char *backend)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
PyErr_Format(PyExc_ValueError, "invalid backend: %s", backend);
|
PyErr_Format(PyExc_ValueError, "invalid backend: %s", backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue