kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #10234
Re: Regression Testing
Lorenzo, about python references and GC,
It usually will take care of the objects you create from python
but if you pass them to any other object, which will take care
of deletion later, then you can tell python/swig not to take care of deletion
anymore (stop being the owner of the object) by doing object.thisown = 0
If the object is obtained via GetBoard() , it won't be deleted by python
because he doesn't own it.
Miguel Angel Ajo
http://www.nbee.es (http://www.nbee.es/)
+34911407752
skype: ajoajoajo
On Wednesday, 1 de May de 2013 at 15:04, Lorenzo Marcantonio wrote:
> On Wed, May 01, 2013 at 02:45:15PM +0200, Edwin van den Oetelaar wrote:
> > Ah, I do not have this experience, can you cite a reference or provide
> > an example of this please, it could be incidental.
> >
>
>
> Try the demo in wxwidgets. I think that python would be fine for some
> thing and too slow for others. Like I already said I would have no
> problem with python utilities or reports but I fear that for things used
> 'intensively' it would be a nuisance.
>
> > 'Difficult to see. Always in motion is the future' you might be right there.
>
> Nope, is more like a philosophical issue of python, I fear. Python seems
> to be done more for be extended than to be embedded i.e. it wants to
> rule; the objects in pcbnew are not designed for being called from
> outside (i.e. created or managed) so there are some serious lifecycle
> issues. Once python has an old on an object it's not safe anymore to
> delete it *and* you can't know it has an old to it (that's because, by
> design, objects should be managed by the python collector).
>
> In short, it works but you need to be *very* carefully (to be sure you
> shouldn't save references anywhere). Speed example: GetBoard in python,
> put it in a variable. File/New. Try to use the object. Too bad, it was
> deleted:D
>
> Mind me, it's not a python issue, is the impedence mismatch between
> memory manager (manual vs reference counted, IIRC), it would happen even
> with LUA if you wouldn't be careful to register and unregister each
> object you use.
>
> Other than that it works, just be sure to not call too internal stuff
> (since *everything* is exported:D)
>
> --
> Lorenzo Marcantonio
> Logos Srl
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx (mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx)
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References