Serhiy Storchaka added the comment:

I thought about this issue so long because I can't find good cause for __dict__ 
to be not a dict. Defining the __dict__ method or property doesn't affect 
instance dictionary and attributes lookup. It just breaks the __setstate__ 
method. Without having good example of overriding __dict__ I have no good test 
cases and don't know what a way of handling this error is better.

There is yet one disadvantage of the current implementation. The instance's 
dict can be lazy. It can be created only on demand, when instance's attribute 
is set or the __dict__ attribute is read. PyObject_GetAttrString(myself, 
"__dict__") creates it if it was not created. It would be more efficient to use 
_PyObject_GetDictPtr(). But this is a separate issue, 3.7 only.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31311>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to