From 7ddd42a57a2d63704f7caf30293fb6df9e4acfe3 Mon Sep 17 00:00:00 2001
From: Georg Brandl
Date: Sun, 26 Jun 2005 21:59:34 +0000
Subject: [PATCH] Backport: 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 db46b25d60b5..a52800afef55 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 != '?':
--
2.47.3