mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
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:
parent
9de0a2ba9d
commit
6fd0b0d5ba
2 changed files with 42 additions and 2 deletions
|
@ -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 =====
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue