GNOME Bugzilla – Bug 688971
SIGSEGV with some functions decorated with @GObject.property.setter
Last modified: 2013-01-10 11:29:38 UTC
Created attachment 229758 [details] Reduced testcase PyGObject will SIGSEGV if you decorate a setter on function which doesn't begin with A-Z or a-z. It sounds reasonable to require such naming constraint if you're creating a property, but it isn't when you're adding a setter to already existing one.
Confirmed with current master.
Created attachment 233146 [details] [review] Don't let Property.setter() method names define property names This turned out to be quite a bit more difficult as it seemed; we need to be careful to tell apart the usage as a decorator @GObject.Property def propname(self): from the usage as a constructor propname = GObject.Property(getter=my_getter) In the first case, the method name is the property name, in the second name it isn't; but both forms look exactly the same in Property.__init__(). The only way out here that I can see is to fix the name in setter() when using that. This now satisfies all test cases, including the new one which reproduces this bug.
Review of attachment 233146 [details] [review]: Looks good!