mirror of
https://github.com/python/cpython
synced 2024-09-05 16:38:56 +00:00
gh-78607: Replace __ltrace__ with __lltrace__ (GH-91619)
This commit is contained in:
parent
8560f4a0f2
commit
37965d2fb4
|
@ -273,7 +273,7 @@ Effects of a debug build:
|
|||
* Add :func:`sys.gettotalrefcount` function.
|
||||
* Add :option:`-X showrefcount <-X>` command line option.
|
||||
* Add :envvar:`PYTHONTHREADDEBUG` environment variable.
|
||||
* Add support for the ``__ltrace__`` variable: enable low-level tracing in the
|
||||
* Add support for the ``__lltrace__`` variable: enable low-level tracing in the
|
||||
bytecode evaluation loop if the variable is defined.
|
||||
* Install :ref:`debug hooks on memory allocators <default-memory-allocators>`
|
||||
to detect buffer overflow and other memory errors.
|
||||
|
|
|
@ -137,10 +137,10 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(__le__)
|
||||
STRUCT_FOR_ID(__len__)
|
||||
STRUCT_FOR_ID(__length_hint__)
|
||||
STRUCT_FOR_ID(__lltrace__)
|
||||
STRUCT_FOR_ID(__loader__)
|
||||
STRUCT_FOR_ID(__lshift__)
|
||||
STRUCT_FOR_ID(__lt__)
|
||||
STRUCT_FOR_ID(__ltrace__)
|
||||
STRUCT_FOR_ID(__main__)
|
||||
STRUCT_FOR_ID(__matmul__)
|
||||
STRUCT_FOR_ID(__missing__)
|
||||
|
|
|
@ -760,10 +760,10 @@ extern "C" {
|
|||
INIT_ID(__le__), \
|
||||
INIT_ID(__len__), \
|
||||
INIT_ID(__length_hint__), \
|
||||
INIT_ID(__lltrace__), \
|
||||
INIT_ID(__loader__), \
|
||||
INIT_ID(__lshift__), \
|
||||
INIT_ID(__lt__), \
|
||||
INIT_ID(__ltrace__), \
|
||||
INIT_ID(__main__), \
|
||||
INIT_ID(__matmul__), \
|
||||
INIT_ID(__missing__), \
|
||||
|
|
|
@ -48,9 +48,9 @@ def dont_trace_2():
|
|||
x = 42
|
||||
y = -x
|
||||
dont_trace_1()
|
||||
__ltrace__ = 1
|
||||
__lltrace__ = 1
|
||||
trace_me()
|
||||
del __ltrace__
|
||||
del __lltrace__
|
||||
dont_trace_2()
|
||||
""")
|
||||
self.assertIn("GET_ITER", stdout)
|
||||
|
@ -67,7 +67,7 @@ def dont_trace_2():
|
|||
def test_lltrace_different_module(self):
|
||||
stdout = self.run_code("""
|
||||
from test import test_lltrace
|
||||
test_lltrace.__ltrace__ = 1
|
||||
test_lltrace.__lltrace__ = 1
|
||||
test_lltrace.example()
|
||||
""")
|
||||
self.assertIn("'example' in module 'test.test_lltrace'", stdout)
|
||||
|
@ -95,13 +95,13 @@ def test_lltrace_different_module(self):
|
|||
def test_lltrace_does_not_crash_on_subscript_operator(self):
|
||||
# If this test fails, it will reproduce a crash reported as
|
||||
# bpo-34113. The crash happened at the command line console of
|
||||
# debug Python builds with __ltrace__ enabled (only possible in console),
|
||||
# debug Python builds with __lltrace__ enabled (only possible in console),
|
||||
# when the internal Python stack was negatively adjusted
|
||||
stdout = self.run_code("""
|
||||
import code
|
||||
|
||||
console = code.InteractiveConsole()
|
||||
console.push('__ltrace__ = 1')
|
||||
console.push('__lltrace__ = 1')
|
||||
console.push('a = [1, 2, 3]')
|
||||
console.push('a[0] = 1')
|
||||
print('unreachable if bug exists')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
The LLTRACE special build now looks for the name ``__lltrace__`` defined in module globals, rather than the name ``__ltrace__``, which had been introduced as a typo.
|
|
@ -94,7 +94,7 @@ Compile in support for Low Level TRACE-ing of the main interpreter loop.
|
|||
|
||||
When this preprocessor symbol is defined, before PyEval_EvalFrame executes a
|
||||
frame's code it checks the frame's global namespace for a variable
|
||||
"__ltrace__". If such a variable is found, mounds of information about what
|
||||
"__lltrace__". If such a variable is found, mounds of information about what
|
||||
the interpreter is doing are sprayed to stdout, such as every opcode and opcode
|
||||
argument and values pushed onto and popped off the value stack.
|
||||
|
||||
|
|
|
@ -1729,7 +1729,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
|
|||
|
||||
#ifdef LLTRACE
|
||||
{
|
||||
int r = PyDict_Contains(GLOBALS(), &_Py_ID(__ltrace__));
|
||||
int r = PyDict_Contains(GLOBALS(), &_Py_ID(__lltrace__));
|
||||
if (r < 0) {
|
||||
goto exit_unwind;
|
||||
}
|
||||
|
|
|
@ -468,7 +468,6 @@ Python/ceval.c:_PyEval_EvalFrameDefault():PyId___annotations__ _Py_IDENTIFIER(
|
|||
Python/ceval.c:_PyEval_EvalFrameDefault():PyId___build_class__ _Py_IDENTIFIER(__build_class__)
|
||||
Python/ceval.c:_PyEval_EvalFrameDefault():PyId___enter__ _Py_IDENTIFIER(__enter__)
|
||||
Python/ceval.c:_PyEval_EvalFrameDefault():PyId___exit__ _Py_IDENTIFIER(__exit__)
|
||||
Python/ceval.c:_PyEval_EvalFrameDefault():PyId___ltrace__ _Py_IDENTIFIER(__ltrace__)
|
||||
Python/ceval.c:_PyEval_EvalFrameDefault():PyId_displayhook _Py_IDENTIFIER(displayhook)
|
||||
Python/ceval.c:_PyEval_EvalFrameDefault():PyId_send _Py_IDENTIFIER(send)
|
||||
Python/ceval.c:import_all_from():PyId___all__ _Py_IDENTIFIER(__all__)
|
||||
|
|
Loading…
Reference in a new issue