File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,12 @@ def warning_print(fmt, *args):
100
100
101
101
if debug :
102
102
103
+ class _debug_caller_lineno :
104
+ def __str__ (self ):
105
+ return str (inspect .currentframe ().f_back .f_back .f_back .f_lineno )
106
+
107
+ debug_caller_lineno = _debug_caller_lineno ()
108
+
103
109
def debug_print (fmt , * args ):
104
110
fmt = "[%4d] " + fmt
105
111
args = (inspect .currentframe ().f_back .f_lineno ,) + args
@@ -108,6 +114,8 @@ def debug_print(fmt, *args):
108
114
109
115
else :
110
116
117
+ debug_caller_lineno = None
118
+
111
119
def debug_print (fmt , * args ):
112
120
pass
113
121
@@ -3237,10 +3245,10 @@ def _evaluate_stack(self, token=None):
3237
3245
nameStackCopy = self .nameStack [:]
3238
3246
3239
3247
debug_print (
3240
- "Evaluating stack %s\n BraceDepth: %s (called from %d )" ,
3248
+ "Evaluating stack %s\n BraceDepth: %s (called from %s )" ,
3241
3249
self .nameStack ,
3242
3250
self .braceDepth ,
3243
- inspect . currentframe (). f_back . f_lineno ,
3251
+ debug_caller_lineno ,
3244
3252
)
3245
3253
3246
3254
# Handle special case of overloading operator ()
You can’t perform that action at this time.
0 commit comments