Python update-Callback infinite recursion
Closed, InvalidPublic



OS: Windows 7 64bit
3D-Card: Nvidia GTX 560
Blender Version: 2.58 r37724

the new update-callbacks for python go into a (indirect) recursion
if the variable which called the update-callback is changed within the update-callback.
The following example crashes if the String- and IntProperty are changed.
If the StringProperty is substituted with a FloatProperty or if only the StringProperty is changed
it doesnt crash.

import bpy

def func(self, context):
bpy.context.scene.my_settings.my_int = 2
bpy.context.scene.my_settings.my_string = "crash"

class MaterialSettings(bpy.types.PropertyGroup):
my_int = bpy.props.IntProperty(update=func)
my_string = bpy.props.StringProperty(update=func)


bpy.types.Scene.my_settings = \

bpy.context.scene.my_settings.my_string = "start"
bpy.context.scene.my_settings.my_int = 2

Ton Roosendaal (ton) added a comment.Via Old WorldJul 10 2011, 3:56 PM

Assigning to campbell, he's with holidays now so it'll take a week or more.

Sergey Sharybin (sergey) added a comment.Via Old WorldDec 2 2011, 4:28 PM

Campbell, do you have any progress here? :)

Thinking about this, a property update function should remain low level, IMHO its reasonable to have users responsible for not getting into problematic situations where infinite recursion happens, Added note to docs saying this.


Campbell Barton (campbellbarton) closed this task as "Invalid".Via Old WorldSep 28 2012, 11:36 AM

Add Comment