commit the portion of PyXML patch #919008 that is relevant to the

standard library:
str() of xml.sax.SAXParseException should not fail if the line and/or
column number returned by the locator are None
(tests added)
This commit is contained in:
Fred Drake 2004-03-20 08:15:30 +00:00
parent 9de0a2ba9d
commit 6fd0b0d5ba
2 changed files with 42 additions and 2 deletions

View file

@ -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 =====