]> granicus.if.org Git - python/commit
Make __class__ assignment possible, when the object structures are the
authorGuido van Rossum <guido@python.org>
Tue, 25 Sep 2001 03:43:42 +0000 (03:43 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 25 Sep 2001 03:43:42 +0000 (03:43 +0000)
commit5c294fb0e634afc4807ca83032ace356512c97dc
tree71a9bb4e810bbb936dca64369f49098a4a225196
parent2306d246e8c5bb928a432726178047b8d50776f5
Make __class__ assignment possible, when the object structures are the
same.  I hope the test for structural equivalence is stringent enough.
It only allows the assignment if the old and new types:

- have the same basic size
- have the same item size
- have the same dict offset
- have the same weaklist offset
- have the same GC flag bit
- have a common base that is the same except for maybe the dict and
  weaklist (which may have been added separately at the same offsets
  in both types)
Lib/test/test_descr.py
Objects/typeobject.c