Author Matthias Braun
Recipients Matthias Braun
Date 2020-03-13.22:31:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584138664.49.0.0727456636956.issue39960@roundup.psfhosted.org>
In-reply-to
Content
This is about an extension type created via `PyType_FromSpec` that overrides `tp_setattro` (minimal example attached). In this case cpython does not let me grab and use the `__setattr__` function "manually". Example:

```
>>> import demo
>>> mytype_setattr = demo.MyType.__setattr__
>>> i = demo.MyType()
>>> mytype_setattr(i, "foo", "bar")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't apply this __setattr__ to object object
```

I suspect this is related to the loop at the beginning of typeobject.c / hackcheck() that skips over types with Py_TPFLAGS_HEAPOBJECT. (Though removing the loop breaks things like the enum module).
History
Date User Action Args
2020-03-13 22:31:04Matthias Braunsetrecipients: + Matthias Braun
2020-03-13 22:31:04Matthias Braunsetmessageid: <1584138664.49.0.0727456636956.issue39960@roundup.psfhosted.org>
2020-03-13 22:31:04Matthias Braunlinkissue39960 messages
2020-03-13 22:31:04Matthias Brauncreate