Skip to content

Commit 636c8e1

Browse files
authored
Merge branch 'main' into binary_subscr_to_op
2 parents 95fb6dc + fbaa6c8 commit 636c8e1

File tree

9 files changed

+25
-49
lines changed

9 files changed

+25
-49
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the internal ``LLTRACE`` macro (use :c:macro:`Py_DEBUG` instead).

Misc/SpecialBuilds.txt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,16 @@ Py_DEBUG
7878

7979
This is what is generally meant by "a debug build" of Python.
8080

81-
Py_DEBUG implies LLTRACE and Py_REF_DEBUG. In addition, C assert()s are enabled
81+
Py_DEBUG implies Py_REF_DEBUG. In addition, C assert()s are enabled
8282
(via the C way: by not defining NDEBUG), and some routines do additional sanity
8383
checks inside "#ifdef Py_DEBUG" blocks.
8484

85-
86-
LLTRACE
87-
-------
88-
89-
Compile in support for Low Level TRACE-ing of the main interpreter loop.
90-
91-
When this preprocessor symbol is defined, before PyEval_EvalFrame executes a
92-
frame's code it checks the frame's global namespace for a variable
93-
"__lltrace__". If such a variable is found, mounds of information about what
94-
the interpreter is doing are sprayed to stdout, such as every opcode and opcode
95-
argument and values pushed onto and popped off the value stack.
96-
97-
Not useful very often, but very useful when needed.
98-
99-
Py_DEBUG implies LLTRACE.
85+
Also, compile in support for "lltrace" (Low Level TRACE-ing) of the main
86+
interpreter loop. Before _PyEval_EvalFrameDefault executes a frame's code, it
87+
checks the frame's global namespace for a variable "__lltrace__" (as well as for
88+
the environment variable PYTHON_LLTRACE"). If such a variable is found, mounds
89+
of information about what the interpreter is doing are sprayed to stdout, such
90+
as every opcode and opcode argument and values pushed onto and popped off the
91+
value stack. Higher integer values for the environment variable result in more
92+
and more detail being printed (the global __lltrace__ always enables the maximum
93+
output). Not useful very often, but *very* useful when needed.

Python/bytecodes.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5273,7 +5273,7 @@ dummy_func(
52735273
goto exception_unwind;
52745274
}
52755275
/* Resume normal execution */
5276-
#ifdef LLTRACE
5276+
#ifdef Py_DEBUG
52775277
if (frame->lltrace >= 5) {
52785278
lltrace_resume_frame(frame);
52795279
}
@@ -5312,15 +5312,7 @@ dummy_func(
53125312
}
53135313
next_instr = frame->instr_ptr;
53145314

5315-
#ifdef LLTRACE
5316-
{
5317-
int lltrace = maybe_lltrace_resume_frame(frame, GLOBALS());
5318-
frame->lltrace = lltrace;
5319-
if (lltrace < 0) {
5320-
goto exit_unwind;
5321-
}
5322-
}
5323-
#endif
5315+
LLTRACE_RESUME_FRAME();
53245316

53255317
#ifdef Py_DEBUG
53265318
/* _PyEval_EvalFrameDefault() must not be called with an exception set,

Python/ceval.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@
4343

4444
#include <stdbool.h> // bool
4545

46-
#ifdef Py_DEBUG
47-
/* For debugging the interpreter: */
48-
# define LLTRACE 1 /* Low-level trace feature */
49-
#endif
50-
5146
#if !defined(Py_BUILD_CORE)
5247
# error "ceval.c must be build with Py_BUILD_CORE define for best performance"
5348
#endif
@@ -136,7 +131,7 @@
136131
#endif
137132

138133

139-
#ifdef LLTRACE
134+
#ifdef Py_DEBUG
140135
static void
141136
dump_stack(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer)
142137
{
@@ -819,7 +814,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
819814
entry_frame.owner = FRAME_OWNED_BY_INTERPRETER;
820815
entry_frame.visited = 0;
821816
entry_frame.return_offset = 0;
822-
#ifdef LLTRACE
817+
#ifdef Py_DEBUG
823818
entry_frame.lltrace = 0;
824819
#endif
825820
/* Push frame */

Python/ceval_macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,21 @@
108108
#endif
109109

110110
/* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */
111-
#ifdef LLTRACE
111+
#ifdef Py_DEBUG
112112
#define PRE_DISPATCH_GOTO() if (frame->lltrace >= 5) { \
113113
lltrace_instruction(frame, stack_pointer, next_instr, opcode, oparg); }
114114
#else
115115
#define PRE_DISPATCH_GOTO() ((void)0)
116116
#endif
117117

118-
#if LLTRACE
118+
#ifdef Py_DEBUG
119119
#define LLTRACE_RESUME_FRAME() \
120120
do { \
121121
int lltrace = maybe_lltrace_resume_frame(frame, GLOBALS()); \
122-
frame->lltrace = lltrace; \
123122
if (lltrace < 0) { \
124123
JUMP_TO_LABEL(exit_unwind); \
125124
} \
125+
frame->lltrace = lltrace; \
126126
} while (0)
127127
#else
128128
#define LLTRACE_RESUME_FRAME() ((void)0)

Python/generated_cases.c.h

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/c-analyzer/TODO

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ Objects/tupleobject.c:_Py_tuple_zero_allocs Py_ssize_t _Py_
6969
Objects/typeobject.c:next_version_tag static unsigned int next_version_tag
7070
Python/Python-ast.c:init_types():initialized static int initialized
7171
Python/bootstrap_hash.c:urandom_cache static struct { int fd; dev_t st_dev; ino_t st_ino; } urandom_cache
72-
Python/ceval.c:lltrace static int lltrace
7372
Python/ceval.c:make_pending_calls():busy static int busy
7473
Python/dynload_shlib.c:handles static struct { dev_t dev; ino_t ino; void *handle; } handles[128]
7574
Python/dynload_shlib.c:nhandles static int nhandles

Tools/cases_generator/analyzer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
676676
"backoff_counter_triggers",
677677
"initial_temperature_backoff_counter",
678678
"JUMP_TO_LABEL",
679-
"maybe_lltrace_resume_frame",
680679
"restart_backoff_counter",
681680
)
682681

Tools/jit/template.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ do { \
8181
#undef WITHIN_STACK_BOUNDS
8282
#define WITHIN_STACK_BOUNDS() 1
8383

84+
#undef LLTRACE_RESUME_FRAME
85+
#define LLTRACE_RESUME_FRAME() \
86+
do { \
87+
} while (0)
88+
8489
#define TIER_TWO 2
8590

8691
__attribute__((preserve_none)) _Py_CODEUNIT *

0 commit comments

Comments
 (0)