Skip to content

Commit 8cf4b34

Browse files
sblondonserhiy-storchaka
authored andcommitted
bpo-33311: Do not display parameters displayed in parentheses for module call. (GH-6677)
1 parent ddb6215 commit 8cf4b34

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Lib/cgitb.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ def html(einfo, context=5):
124124
args, varargs, varkw, locals = inspect.getargvalues(frame)
125125
call = ''
126126
if func != '?':
127-
call = 'in ' + strong(pydoc.html.escape(func)) + \
128-
inspect.formatargvalues(args, varargs, varkw, locals,
127+
call = 'in ' + strong(pydoc.html.escape(func))
128+
if func != "<module>":
129+
call += inspect.formatargvalues(args, varargs, varkw, locals,
129130
formatvalue=lambda value: '=' + pydoc.html.repr(value))
130131

131132
highlight = {}
@@ -207,8 +208,9 @@ def text(einfo, context=5):
207208
args, varargs, varkw, locals = inspect.getargvalues(frame)
208209
call = ''
209210
if func != '?':
210-
call = 'in ' + func + \
211-
inspect.formatargvalues(args, varargs, varkw, locals,
211+
call = 'in ' + func
212+
if func != "<module>":
213+
call += inspect.formatargvalues(args, varargs, varkw, locals,
212214
formatvalue=lambda value: '=' + pydoc.text.repr(value))
213215

214216
highlight = {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Text and html output generated by cgitb does not display parentheses if the
2+
current call is done directly in the module. Patch by Stéphane Blondon.

0 commit comments

Comments
 (0)