[Python-checkins] bpo-33311: Do not display parameters displayed in parentheses for module call. (GH-6677)

Serhiy Storchaka webhook-mailer at python.org
Wed May 9 05:39:35 EDT 2018


https://github.com/python/cpython/commit/8cf4b34b3665b8bb39ea7111e6b5c3410899d3e4
commit: 8cf4b34b3665b8bb39ea7111e6b5c3410899d3e4
branch: master
author: sblondon <sblondon at users.noreply.github.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-05-09T12:39:32+03:00
summary:

bpo-33311: Do not display parameters displayed in parentheses for module call. (GH-6677)

files:
A Misc/NEWS.d/next/Library/2018-05-01-22-33-14.bpo-33311.8YPB-k.rst
M Lib/cgitb.py

diff --git a/Lib/cgitb.py b/Lib/cgitb.py
index 0f5f32c0fade..4f81271be3ca 100644
--- a/Lib/cgitb.py
+++ b/Lib/cgitb.py
@@ -124,8 +124,9 @@ def html(einfo, context=5):
         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 @@ def text(einfo, context=5):
         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
index 000000000000..d0218de373ca
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-05-01-22-33-14.bpo-33311.8YPB-k.rst
@@ -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.



More information about the Python-checkins mailing list