[wxPython] Odd Error

Hi guys,

In the pySketch program I've been working on, I often get the following exceptions raised during program exit:

Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 8dd290> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxSizePtr.__del__ of wxSize instance at 972890> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 9723b0> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 979eb0> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 979a20> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxSizePtr.__del__ of wxSize instance at 9522a0> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 9517c0> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxSizePtr.__del__ of wxSize instance at 972a80> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 954a80> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 972720> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 953890> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 791ba0> ignored
Exception exceptions.TypeError: 'call of non-function (type None)' in <method wxPointPtr.__del__ of wxPoint instance at 979920> ignored

Is this because of something I'm doing wrong, or is there perhaps some garbage-collection problems within wxPython itself? I searched through the mailing list archives, and found a reference to a similar problem with wxBitmapPtr -- to suggested that the problem was a bug in the implementation of the __del__ method.

Is there anything I can do to stop these errors appearing, or are they caused by a bug in wxPython itself?

Thanks,

  - Erik.

><method wxPointPtr.__del__ of wxPoint instance at 953890> ignored
>Exception exceptions.TypeError: 'call of non-function (type None)' in
><method wxPointPtr.__del__ of wxPoint instance at 791ba0> ignored
>Exception exceptions.TypeError: 'call of non-function (type None)' in
><method wxPointPtr.__del__ of wxPoint instance at 979920> ignored

Is this because of something I'm doing wrong, or is there perhaps some
garbage-collection problems within wxPython itself?

It's the order that Python cleans up objects when the interpreter shuts
down. It does as much as it can the normal way (refcounting) and then
forces things after that. You've got some (probably) global wxPoint's and
wxSize's that aren't being deleted until the module the deletion function
lives in has already been deleted. So when __del__ is finally called on
them it ends up with an error because there's nothing to call. The trick
shown below with the default parameter usually does the trick, but not
always.

    def __del__(self,miscc=miscc):
        if self.thisown == 1 :
            miscc.delete_wxPoint(self)

Best thing to do is move the globals into an object that you know is cleaned
up before Python starts doing its shutdown thing.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!