Jonas H. <jo...@lophus.org> added the comment:

Here comes a patch, changing the behaviour to:

./python -q
>>> class C:
...   pass
... 
>>> (1).__class__ = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __class__ must be set to a class defined by a class statement, not 
'int' object
>>> (1).__class__ = object
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: class__ must be set to a class defined by a class statement, not 
'object'
>>> (1).__class__ = C
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __class__ assignment: only for instances of classes defined by class 
statements

----------
keywords: +patch
nosy: +jonash
Added file: http://bugs.python.org/file20937/4600.diff

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

Reply via email to