8000 gh-78607: Replace __ltrace__ with __lltrace__ by sweeneyde · Pull Request #91619 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-78607: Replace __ltrace__ with __lltrace__ #91619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_global_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_runtime_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__), \
Expand Down
10 changes: 5 additions & 5 deletions Lib/test/test_lltrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion Misc/SpecialBuilds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion Tools/c-analyzer/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
0