bh: thuban/libraries/pyprojection Projection.py, 1.1, 1.2 Projection.i, 1.2, 1.3

cvs@intevation.de cvs at intevation.de
Mon Dec 13 18:54:38 CET 2004


Author: bh

Update of /thubanrepository/thuban/libraries/pyprojection
In directory doto:/tmp/cvs-serv13221/libraries/pyprojection

Modified Files:
	Projection.py Projection.i 
Log Message:
* libraries/pyprojection/Projection.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.

* libraries/pyprojection/Projection.py: Updated from Projection.i
with SWIG.


Index: Projection.py
===================================================================
RCS file: /thubanrepository/thuban/libraries/pyprojection/Projection.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Projection.py	19 Aug 2003 21:19:59 -0000	1.1
+++ Projection.py	13 Dec 2004 17:54:36 -0000	1.2
@@ -36,6 +36,11 @@
         raise AttributeError,name
     def __repr__(self):
         return "<C Projection instance at %s>" % (self.this,)
+    
+    def __del__(self,Projectionc=Projectionc):
+        if getattr(self, 'thisown', 0):
+            Projectionc.delete_Projection(self)
+    
 class ProjectionPtr(Projection):
     def __init__(self,this):
         self.this = this

Index: Projection.i
===================================================================
RCS file: /thubanrepository/thuban/libraries/pyprojection/Projection.i,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Projection.i	29 Aug 2003 09:49:09 -0000	1.2
+++ Projection.i	13 Dec 2004 17:54:36 -0000	1.3
@@ -155,6 +155,20 @@
 	    return PyCObject_FromVoidPtr(self->proj, NULL);
 	}
 
+
+	/* 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,Projectionc=Projectionc):
+        if getattr(self, 'thisown', 0):
+            Projectionc.delete_Projection(self)
+    "
+
     }
 } Projection;
 





More information about the Thuban-devel mailing list

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