mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
_exceptions: Format a missing system id as <unknown>.
expatreader: Use the error handler instead of raising exception directly.
This commit is contained in:
parent
3383792c74
commit
04f4943d13
2 changed files with 7 additions and 5 deletions
|
@ -79,10 +79,11 @@ class SAXParseException(SAXException):
|
|||
|
||||
def __str__(self):
|
||||
"Create a string representation of the exception."
|
||||
return "%s at %s:%d:%d" % (self._msg,
|
||||
self.getSystemId(),
|
||||
self.getLineNumber(),
|
||||
self.getColumnNumber())
|
||||
sysid = self.getSystemId()
|
||||
if sysid is None:
|
||||
sysid = "<unknown>"
|
||||
return "%s:%d:%d: %s" % (sysid, self.getLineNumber(),
|
||||
self.getColumnNumber(), self._msg)
|
||||
|
||||
|
||||
# ===== SAXNOTRECOGNIZEDEXCEPTION =====
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue