]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport: Prevent creating a HTML link to file://?/
authorGeorg Brandl <georg@python.org>
Sun, 26 Jun 2005 21:59:34 +0000 (21:59 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 26 Jun 2005 21:59:34 +0000 (21:59 +0000)
Lib/cgitb.py

index db46b25d60b5c76737bdfff2f474959d25b83d8b..a52800afef55d361e3270a8db343aea97041c9cf 100644 (file)
@@ -112,8 +112,11 @@ function calls leading up to the error, in the order they occurred.</p>'''
     frames = []
     records = inspect.getinnerframes(etb, context)
     for frame, file, lnum, func, lines, index in records:
-        file = file and os.path.abspath(file) or '?'
-        link = '<a href="file://%s">%s</a>' % (file, pydoc.html.escape(file))
+        if file:
+            file = os.path.abspath(file)
+            link = '<a href="file://%s">%s</a>' % (file, pydoc.html.escape(file))
+        else:
+            file = link = '?'
         args, varargs, varkw, locals = inspect.getargvalues(frame)
         call = ''
         if func != '?':