[Python-bugs-list] [ python-Bugs-452220 ] __class__ assignment

noreply@sourceforge.net noreply@sourceforge.net
Fri, 17 Aug 2001 14:12:50 -0700


Bugs item #452220, was opened at 2001-08-17 14:12
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=452220&group_id=5470

Category: Type/class unification
Group: Python 2.2
Status: Open
Resolution: None
Priority: 2
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: __class__ assignment

Initial Comment:
When safe assignment to x.__class__ should be
supported.

It's safe when the struct layout of the old and new
class is compatinle.

A sufficient safety condition is that the struct sizes
are the same and there's a shared ancestor that also
has the same size. (varitems, GC support and
dict/weakref slots may complicate matters).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=452220&group_id=5470