cpyext: writing readonly attribute raises TypeError instead of AttributeError

Issue #2788 resolved
Christoph Reiter
created an issue

An attribute defined through tp_getset with a PyGetSetDef struct where the attribute entry has a NULL setter leads to the following differences:

CPython:

Traceback (most recent call last):
  File "a.py", line 3, in <module>
    GObject.TYPE_STRING.name = "foo"
AttributeError: attribute 'name' of 'gobject.GType' objects is not writable

PyPy:

Traceback (most recent call last):
  File "a.py", line 3, in <module>
    GObject.TYPE_STRING.name = "foo"
TypeError: readonly attribute

Comments (4)

  1. Log in to comment