]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-33256: Replace angle brackets around python object repr to display it in...
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 30 Apr 2018 08:34:47 +0000 (11:34 +0300)
committerGitHub <noreply@github.com>
Mon, 30 Apr 2018 08:34:47 +0000 (11:34 +0300)
(cherry picked from commit 7d68bfa82654ba01d860b8a772ff63bf0bd183ee)

Co-authored-by: sblondon <sblondon@users.noreply.github.com>
Lib/cgitb.py
Misc/ACKS
Misc/NEWS.d/next/Library/2018-04-10-20-57-14.bpo-33256.ndHkqu.rst [new file with mode: 0644]

index 8acc4b75fe3b384c144ed14c23626188948612e4..3689f8a4ba0238458b7931fd1d461d74454515f8 100644 (file)
@@ -125,7 +125,7 @@ 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(func) + \
+            call = 'in ' + strong(pydoc.html.escape(func)) + \
                 inspect.formatargvalues(args, varargs, varkw, locals,
                     formatvalue=lambda value: '=' + pydoc.html.repr(value))
 
@@ -285,7 +285,7 @@ class Hook:
 
         if self.display:
             if plain:
-                doc = doc.replace('&', '&amp;').replace('<', '&lt;')
+                doc = pydoc.html.escape(doc)
                 self.file.write('<pre>' + doc + '</pre>\n')
             else:
                 self.file.write(doc + '\n')
index 28255740c7f0bcdc078a8e696fcfd8a84c03a6b4..580b0c5bf76dd59917747b696df38d65908bbbb7 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -138,6 +138,7 @@ Mike Bland
 Martin Bless
 Pablo Bleyer
 Erik van Blokland
+Stéphane Blondon
 Eric Blossom
 Sergey Bobrov
 Finn Bock
diff --git a/Misc/NEWS.d/next/Library/2018-04-10-20-57-14.bpo-33256.ndHkqu.rst b/Misc/NEWS.d/next/Library/2018-04-10-20-57-14.bpo-33256.ndHkqu.rst
new file mode 100644 (file)
index 0000000..a0605c0
--- /dev/null
@@ -0,0 +1 @@
+Fix display of ``<module>`` call in the html produced by ``cgitb.html()``. Patch by Stéphane Blondon.