Author jonash
Recipients Trundle, docs@python, jonash, stutzbach, terry.reedy
Date 2011-02-27.18:00:31
SpamBayes Score 1.02898e-06
Marked as misclassified No
Message-id <1298829632.48.0.301800168145.issue4600@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-02-27 18:00:32jonashsetrecipients: + jonash, terry.reedy, stutzbach, Trundle, docs@python
2011-02-27 18:00:32jonashsetmessageid: <1298829632.48.0.301800168145.issue4600@psf.upfronthosting.co.za>
2011-02-27 18:00:31jonashlinkissue4600 messages
2011-02-27 18:00:31jonashcreate