]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-78607: Replace __ltrace__ with __lltrace__ (GH-91619)
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Sat, 16 Apr 2022 22:57:00 +0000 (18:57 -0400)
committerGitHub <noreply@github.com>
Sat, 16 Apr 2022 22:57:00 +0000 (18:57 -0400)
Doc/using/configure.rst
Include/internal/pycore_global_strings.h
Include/internal/pycore_runtime_init.h
Lib/test/test_lltrace.py
Misc/NEWS.d/next/Core and Builtins/2022-04-16-21-54-31.gh-issue-78607._Y7bMm.rst [new file with mode: 0644]
Misc/SpecialBuilds.txt
Python/ceval.c
Tools/c-analyzer/TODO

index b46157cc6ad590d884f729d3ce7c09002a9a4c49..2e632d822f9bdbdfbabf4f546f9be16b9eb7cee2 100644 (file)
@@ -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.
index 77f96cd5ed2f0bb617c2d5a7fe2b8d31f2310fe9..cc94662256e87e147260e777c5b7a080dfe3ae21 100644 (file)
@@ -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__)
index 371f2d23ad8ec51e1da9a0aca7d0159ea4b76750..9a3a9d04324ba839bc4f1d5411d600df3ac29af3 100644 (file)
@@ -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__), \
index 75b377b637b9aa02f80a9c3c4e7d95db0f5ea652..63b65e4b2f821aae85fdc07b03d790a7bd0f3efd 100644 (file)
@@ -48,9 +48,9 @@ class TestLLTrace(unittest.TestCase):
                 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 @@ class TestLLTrace(unittest.TestCase):
     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 @@ class TestLLTrace(unittest.TestCase):
     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')
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-04-16-21-54-31.gh-issue-78607._Y7bMm.rst b/Misc/NEWS.d/next/Core and Builtins/2022-04-16-21-54-31.gh-issue-78607._Y7bMm.rst
new file mode 100644 (file)
index 0000000..808aedd
--- /dev/null
@@ -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.
index a7cee8098e9c0f3912f879c0be4686cac62577c8..5609928284d44880d007c86426d272d376a0357a 100644 (file)
@@ -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.
 
index d6f11d8f4364ae8f767fa4c7b948bdc92dce0112..d358a3134bc63afb2912154502c23f63a30e5bfd 100644 (file)
@@ -1729,7 +1729,7 @@ resume_frame:
 
 #ifdef LLTRACE
     {
-        int r = PyDict_Contains(GLOBALS(), &_Py_ID(__ltrace__));
+        int r = PyDict_Contains(GLOBALS(), &_Py_ID(__lltrace__));
         if (r < 0) {
             goto exit_unwind;
         }
index 6683df5993b8c0b4f832adebd1f482704ed66626..43760369b1980eb082885ed8f386e0da40765f02 100644 (file)
@@ -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__)