bh: thuban/libraries/pyshapelib dbflib.py, 1.3, 1.4 dbflib.i, 1.4, 1.5 ChangeLog, 1.6, 1.7

cvs@intevation.de cvs at intevation.de
Mon Dec 13 18:57:06 CET 2004


Author: bh

Update of /thubanrepository/thuban/libraries/pyshapelib
In directory doto:/tmp/cvs-serv13305/libraries/pyshapelib

Modified Files:
	dbflib.py dbflib.i ChangeLog 
Log Message:
* dbflib.py: Updated from difflib.i with SWIG.

* dbflib.i: Work around a bug in the generated python code which
leads to exception in the __del__ method when the constructor
fails.  See the comments in the code for more details.


Index: dbflib.py
===================================================================
RCS file: /thubanrepository/thuban/libraries/pyshapelib/dbflib.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbflib.py	17 May 2004 15:47:57 -0000	1.3
+++ dbflib.py	13 Dec 2004 17:57:04 -0000	1.4
@@ -38,6 +38,11 @@
     def __repr__(self):
         return "<C DBFFile instance at %s>" % (self.this,)
     if not dbflibc._have_commit: del commit
+    
+    def __del__(self,dbflibc=dbflibc):
+        if getattr(self, 'thisown', 0):
+            dbflibc.delete_DBFFile(self)
+    
 class DBFFilePtr(DBFFile):
     def __init__(self,this):
         self.this = this

Index: dbflib.i
===================================================================
RCS file: /thubanrepository/thuban/libraries/pyshapelib/dbflib.i,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbflib.i	17 May 2004 15:47:57 -0000	1.4
+++ dbflib.i	13 Dec 2004 17:57:04 -0000	1.5
@@ -529,6 +529,20 @@
 	 */
 	%pragma(python) addtomethod="__class__:if not dbflibc._have_commit: del commit"
 
+	/* The __del__ method generated by the old SWIG version we're
+	 * tries to access self.thisown which may not be set at all when
+	 * there was an exception during construction.  Therefore we
+	 * override it with our own version.
+	 * FIXME: It would be better to upgrade to a newer SWIG version
+	 * or to get rid of SWIG entirely.
+	 */
+	%pragma(python) addtoclass = "
+    def __del__(self,dbflibc=dbflibc):
+        if getattr(self, 'thisown', 0):
+            dbflibc.delete_DBFFile(self)
+    "
+
+
     }
 } DBFFile;
 

Index: ChangeLog
===================================================================
RCS file: /thubanrepository/thuban/libraries/pyshapelib/ChangeLog,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ChangeLog	28 May 2004 19:07:27 -0000	1.6
+++ ChangeLog	13 Dec 2004 17:57:04 -0000	1.7
@@ -1,3 +1,11 @@
+2004-12-13  Bernhard Herzog  <bh at intevation.de>
+
+	* dbflib.py: Updated from difflib.i with SWIG.
+
+	* dbflib.i: Work around a bug in the generated python code which
+	leads to exception in the __del__ method when the constructor
+	fails.  See the comments in the code for more details.
+
 2004-05-28  Bernhard Herzog  <bh at intevation.de>
 
 	* README: Flesh out the some more.  Correct the shapelib





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)