[Bf-python] Python bug with user counts
Willian Padovani Germano
wgermano at superig.com.br
Mon Jan 22 03:28:57 CET 2007
Hi,
Martin Poirier wrote:
> If yes, there's a good reason why it wasn't
> deallocated. We reuse the same global namespace
> between each script so they can share values. (if that
> is a good idea is debatable), so the BPyobject would
> have persisted there, even if the script threw an
> exception.
We don't. Each script has its own global dictionary, created for it and
freed once the script finishes executing. That's why there's the
Registry module, to have a persistent global dict where scripts can put
data. Glabal dict for pydrivers (and py button) is also persistent,
freed on errors. Modules themselves, though, keep data, so if you do
something like:
Blender.myvar = 10
it will stay like that until something specific is done about it.
Again, making bpy a "user" of Blender data may be more troublesome than
it's worth, since the original system wasn't done with that possibility
in mind. Maybe we should add a new toggle or counter specific to BPy
data, like id.py_us or something, that would always be zeroed when
exiting from Blender or restarting Python. Anyway, something to be
investigated / discussed properly.
--
Willian
More information about the Bf-python
mailing list