From 07c81d9074fd72cb6a7ad1548685a87d5a764a09 Mon Sep 17 00:00:00 2001
From: Georg Brandl
Date: Sun, 26 Jun 2005 21:57:55 +0000
Subject: [PATCH] Prevent creating a HTML link to file://?/
---
Lib/cgitb.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Lib/cgitb.py b/Lib/cgitb.py
index 735683e50cf..8d979b84453 100644
--- a/Lib/cgitb.py
+++ b/Lib/cgitb.py
@@ -112,8 +112,11 @@ function calls leading up to the error, in the order they occurred.
'''
frames = []
records = inspect.getinnerframes(etb, context)
for frame, file, lnum, func, lines, index in records:
- file = file and os.path.abspath(file) or '?'
- link = '%s' % (file, pydoc.html.escape(file))
+ if file:
+ file = os.path.abspath(file)
+ link = '%s' % (file, pydoc.html.escape(file))
+ else:
+ file = link = '?'
args, varargs, varkw, locals = inspect.getargvalues(frame)
call = ''
if func != '?':