[pypy-issue] Issue #2788: cpyext: writing readonly attribute raises TypeError instead of AttributeError (pypy/pypy)

Christoph Reiter issues-reply at bitbucket.org
Thu Apr 5 13:29:19 EDT 2018


New issue 2788: cpyext: writing readonly attribute raises TypeError instead of AttributeError
https://bitbucket.org/pypy/pypy/issues/2788/cpyext-writing-readonly-attribute-raises

Christoph Reiter:

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

CPython:

```
#!python
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:
```
#!python
Traceback (most recent call last):
  File "a.py", line 3, in <module>
    GObject.TYPE_STRING.name = "foo"
TypeError: readonly attribute
```




More information about the pypy-issue mailing list