[Python-checkins] CVS: python/dist/src/Lib/xml/sax _exceptions.py,1.8,1.9

Martin v. L?wis loewis@users.sourceforge.net
Thu, 22 Mar 2001 07:34:05 -0800


Update of /cvsroot/python/python/dist/src/Lib/xml/sax
In directory usw-pr-cvs1:/tmp/cvs-serv27104

Modified Files:
	_exceptions.py 
Log Message:
Synchronize with 1.6 of PyXML:
Retrieve relevant information at construction time, as it may be lost
when the exception is printed.


Index: _exceptions.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/_exceptions.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** _exceptions.py	2001/01/27 08:56:24	1.8
--- _exceptions.py	2001/03/22 15:34:02	1.9
***************
*** 62,73 ****
          self._locator = locator
  
      def getColumnNumber(self):
          """The column number of the end of the text where the exception
          occurred."""
!         return self._locator.getColumnNumber()
  
      def getLineNumber(self):
          "The line number of the end of the text where the exception occurred."
!         return self._locator.getLineNumber()
  
      def getPublicId(self):
--- 62,81 ----
          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):
          """The column number of the end of the text where the exception
          occurred."""
!         return self._colnum
  
      def getLineNumber(self):
          "The line number of the end of the text where the exception occurred."
!         return self._linenum
  
      def getPublicId(self):
***************
*** 77,81 ****
      def getSystemId(self):
          "Get the system identifier of the entity where the exception occurred."
!         return self._locator.getSystemId()
  
      def __str__(self):
--- 85,89 ----
      def getSystemId(self):
          "Get the system identifier of the entity where the exception occurred."
!         return self._systemId
  
      def __str__(self):