* 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.
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__)
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__), \
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)
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)
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')
--- /dev/null
+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.
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.
#ifdef LLTRACE
{
- int r = PyDict_Contains(GLOBALS(), &_Py_ID(__ltrace__));
+ int r = PyDict_Contains(GLOBALS(), &_Py_ID(__lltrace__));
if (r < 0) {
goto exit_unwind;
}
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__)