Commits

Armin Rigo committed 022f615

Fix the oracle module (blindly)

Comments (0)

Files changed (3)

pypy/module/oracle/interp_connect.py

         self.w_version = None
         self.release = False
 
+        self.register_finalizer()
+
 
     @unwrap_spec(mode=int, handle=int,
                  threaded=bool, twophase=bool, events=bool,
             self.connect(space, mode, twophase)
         return space.wrap(self)
 
-    def __del__(self):
-        self.enqueue_for_destruction(self.environment.space,
-                                     W_Connection.destructor,
-                                     '__del__ method of ')
+    def invoke_finalizer(self):
+        self.finalizer_perform(self.environment.space, '__del__ method of ',
+                               self.destructor)
 
     def destructor(self):
-        assert isinstance(self, W_Connection)
         if self.release:
             roci.OCITransRollback(
                 self.handle, self.environment.errorHandle,

pypy/module/oracle/interp_object.py

         self.environment = connection.environment
         self.isCollection = False
         self.initialize(connection, param)
+        self.register_finalizer()
 
-    def __del__(self):
-        self.enqueue_for_destruction(self.environment.space,
-                                     W_ObjectType.destructor,
-                                     '__del__ method of ')
+    def invoke_finalizer(self):
+        if self.tdo:
+            self.finalizer_perform(self.environment.space, '__del__ method of ',
+                                   self.destructor)
 
     def destructor(self):
-        assert isinstance(self, W_ObjectType)
         if self.tdo:
             roci.OCIObjectUnpin(
                 self.environment.handle,

pypy/module/oracle/interp_variable.py

         # perform extended initialization
         self.initialize(self.environment.space, cursor)
 
-    def __del__(self):
-        self.enqueue_for_destruction(self.environment.space,
-                                     W_Variable.destructor,
-                                     '__del__ method of ')
+        self.register_finalizer()
+
+    def invoke_finalizer(self):
+        self.finalizer_perform(self.environment.space, '__del__ method of ',
+                               self.destructor)
 
     def destructor(self):
-        assert isinstance(self, W_Variable)
         self.finalize()
         lltype.free(self.actualElementsPtr, flavor='raw')
         if self.actualLength: