Skip to content
Snippets Groups Projects
Commit b2a0c2a6ed90 authored by Martin v. Löwis's avatar Martin v. Löwis
Browse files

Synchronize with 1.6 of PyXML:

Retrieve relevant information at construction time, as it may be lost
when the exception is printed.
parent f8986b6ee34a
No related branches found
No related tags found
No related merge requests found
...@@ -61,6 +61,14 @@ ...@@ -61,6 +61,14 @@
SAXException.__init__(self, msg, exception) SAXException.__init__(self, msg, exception)
self._locator = locator self._locator = locator
# We need to cache this stuff at construction time.
# If this exception is thrown, the objects through which we must
# traverse to get this information may be deleted by the time
# it gets caught.
self._systemId = self._locator.getSystemId()
self._colnum = self._locator.getColumnNumber()
self._linenum = self._locator.getLineNumber()
def getColumnNumber(self): def getColumnNumber(self):
"""The column number of the end of the text where the exception """The column number of the end of the text where the exception
occurred.""" occurred."""
...@@ -64,7 +72,7 @@ ...@@ -64,7 +72,7 @@
def getColumnNumber(self): def getColumnNumber(self):
"""The column number of the end of the text where the exception """The column number of the end of the text where the exception
occurred.""" occurred."""
return self._locator.getColumnNumber() return self._colnum
def getLineNumber(self): def getLineNumber(self):
"The line number of the end of the text where the exception occurred." "The line number of the end of the text where the exception occurred."
...@@ -68,7 +76,7 @@ ...@@ -68,7 +76,7 @@
def getLineNumber(self): def getLineNumber(self):
"The line number of the end of the text where the exception occurred." "The line number of the end of the text where the exception occurred."
return self._locator.getLineNumber() return self._linenum
def getPublicId(self): def getPublicId(self):
"Get the public identifier of the entity where the exception occurred." "Get the public identifier of the entity where the exception occurred."
...@@ -76,7 +84,7 @@ ...@@ -76,7 +84,7 @@
def getSystemId(self): def getSystemId(self):
"Get the system identifier of the entity where the exception occurred." "Get the system identifier of the entity where the exception occurred."
return self._locator.getSystemId() return self._systemId
def __str__(self): def __str__(self):
"Create a string representation of the exception." "Create a string representation of the exception."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment