Skip to content

Commit 07ad02f

Browse files
[2.7] bpo-33256: Replace angle brackets around python object repr to display it in html (GH-6442). (GH-6650)
(cherry picked from commit 7d68bfa) Co-authored-by: sblondon <sblondon@users.noreply.github.com>
1 parent 07c3a61 commit 07ad02f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Lib/cgitb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def html(einfo, context=5):
125125
args, varargs, varkw, locals = inspect.getargvalues(frame)
126126
call = ''
127127
if func != '?':
128-
call = 'in ' + strong(func) + \
128+
call = 'in ' + strong(pydoc.html.escape(func)) + \
129129
inspect.formatargvalues(args, varargs, varkw, locals,
130130
formatvalue=lambda value: '=' + pydoc.html.repr(value))
131131

@@ -285,7 +285,7 @@ def handle(self, info=None):
285285

286286
if self.display:
287287
if plain:
288-
doc = doc.replace('&', '&amp;').replace('<', '&lt;')
288+
doc = pydoc.html.escape(doc)
289289
self.file.write('<pre>' + doc + '</pre>\n')
290290
else:
291291
self.file.write(doc + '\n')

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Mike Bland
138138
Martin Bless
139139
Pablo Bleyer
140140
Erik van Blokland
141+
Stéphane Blondon
141142
Eric Blossom
142143
Sergey Bobrov
143144
Finn Bock
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix display of ``<module>`` call in the html produced by ``cgitb.html()``. Patch by Stéphane Blondon.

0 commit comments

Comments
 (0)