summaryrefslogtreecommitdiff
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-12 19:05:44 +0000
committerGuido van Rossum <guido@python.org>2002-08-12 19:05:44 +0000
commitad47da072a436751c0cfd95a21eccea1c39b35f1 (patch)
tree7c9f38c7d45d06368e075a0c869d08186d9dd1ae /Python/codecs.c
parent115c888b97125e31851fc64cc0292c4fc3b122dd (diff)
downloadcpython-git-ad47da072a436751c0cfd95a21eccea1c39b35f1.tar.gz
Refactor how __dict__ and __weakref__ interact with __slots__.
1. You can now have __dict__ and/or __weakref__ in your __slots__ (before only __weakref__ was supported). This is treated differently than before: it merely sets a flag that the object should support the corresponding magic. 2. Dynamic types now always have descriptors __dict__ and __weakref__ thrust upon them. If the type in fact does not support one or the other, that descriptor's __get__ method will raise AttributeError. 3. (This is the reason for all this; it fixes SF bug 575229, reported by Cesar Douady.) Given this code: class A(object): __slots__ = [] class B(object): pass class C(A, B): __slots__ = [] the class object for C was broken; its size was less than that of B, and some descriptors on B could cause a segfault. C now correctly inherits __weakrefs__ and __dict__ from B, even though A is the "primary" base (C.__base__ is A). 4. Some code cleanup, and a few comments added.
Diffstat (limited to 'Python/codecs.c')
0 files changed, 0 insertions, 0 deletions