After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688971 - SIGSEGV with some functions decorated with @GObject.property.setter
SIGSEGV with some functions decorated with @GObject.property.setter
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
3.4.x
Other Linux
: Normal major
: ---
Assigned To: Martin Pitt
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-24 11:24 UTC by Simonas Kazlauskas
Modified: 2013-01-10 11:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Reduced testcase (230 bytes, text/x-python)
2012-11-24 11:24 UTC, Simonas Kazlauskas
  Details
Don't let Property.setter() method names define property names (4.36 KB, patch)
2013-01-10 11:20 UTC, Martin Pitt
committed Details | Review

Description Simonas Kazlauskas 2012-11-24 11:24:35 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.
Comment 1 Martin Pitt 2013-01-10 07:51:40 UTC
Confirmed with current master.
Comment 2 Martin Pitt 2013-01-10 11:20:58 UTC
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.
Comment 3 Simon Feltman 2013-01-10 11:23:46 UTC
Review of attachment 233146 [details] [review]:

Looks good!