]> granicus.if.org Git - python/commitdiff
bpo-33311: Do not display parameters displayed in parentheses for module call. (GH...
authorsblondon <sblondon@users.noreply.github.com>
Wed, 9 May 2018 09:39:32 +0000 (11:39 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 9 May 2018 09:39:32 +0000 (12:39 +0300)
Lib/cgitb.py
Misc/NEWS.d/next/Library/2018-05-01-22-33-14.bpo-33311.8YPB-k.rst [new file with mode: 0644]

index 0f5f32c0fadee1cf828079f81dded6a5695ac627..4f81271be3ca7864a51bb0ace8f1ee2899b243f4 100644 (file)
@@ -124,8 +124,9 @@ function calls leading up to the error, in the order they occurred.</p>'''
         args, varargs, varkw, locals = inspect.getargvalues(frame)
         call = ''
         if func != '?':
-            call = 'in ' + strong(pydoc.html.escape(func)) + \
-                inspect.formatargvalues(args, varargs, varkw, locals,
+            call = 'in ' + strong(pydoc.html.escape(func))
+            if func != "<module>":
+                call += inspect.formatargvalues(args, varargs, varkw, locals,
                     formatvalue=lambda value: '=' + pydoc.html.repr(value))
 
         highlight = {}
@@ -207,8 +208,9 @@ function calls leading up to the error, in the order they occurred.
         args, varargs, varkw, locals = inspect.getargvalues(frame)
         call = ''
         if func != '?':
-            call = 'in ' + func + \
-                inspect.formatargvalues(args, varargs, varkw, locals,
+            call = 'in ' + func
+            if func != "<module>":
+                call += inspect.formatargvalues(args, varargs, varkw, locals,
                     formatvalue=lambda value: '=' + pydoc.text.repr(value))
 
         highlight = {}
diff --git a/Misc/NEWS.d/next/Library/2018-05-01-22-33-14.bpo-33311.8YPB-k.rst b/Misc/NEWS.d/next/Library/2018-05-01-22-33-14.bpo-33311.8YPB-k.rst
new file mode 100644 (file)
index 0000000..d0218de
--- /dev/null
@@ -0,0 +1,2 @@
+Text and html output generated by cgitb does not display parentheses if the
+current call is done directly in the module. Patch by Stéphane Blondon.