summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r--Lib/xml/sax/_exceptions.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/xml/sax/_exceptions.py b/Lib/xml/sax/_exceptions.py
index 7f128f6..628e80d 100644
--- a/Lib/xml/sax/_exceptions.py
+++ b/Lib/xml/sax/_exceptions.py
@@ -91,8 +91,13 @@ class SAXParseException(SAXException):
sysid = self.getSystemId()
if sysid is None:
sysid = "<unknown>"
- return "%s:%d:%d: %s" % (sysid, self.getLineNumber(),
- self.getColumnNumber(), self._msg)
+ linenum = self.getLineNumber()
+ if linenum is None:
+ linenum = "?"
+ colnum = self.getColumnNumber()
+ if colnum is None:
+ colnum = "?"
+ return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg)
# ===== SAXNOTRECOGNIZEDEXCEPTION =====