This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients Trundle, belopolsky, daniel.urban, eric.araujo, flox, meador.inge, vstinner
Date 2011-02-04.04:54:18
SpamBayes Score 1.6419429e-07
Marked as misclassified No
Message-id <1296795259.01.0.739948825072.issue9756@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a somewhat more straightforward way to reproduce the problem:

>>> class X:
...    __class__ = int
... 
[55910 refs]
>>> isinstance(X(), int)
True
[55914 refs]
>>> int.bit_length(X())
Assertion failed: (PyLong_Check(v)), function long_bit_length, file ../py3k-commit/Objects/longobject.c, line 4413.
Abort trap

The place to implement a stricter check would be in methoddescr_call() function defined in Objects/descrobject.c, but it may affect legitimate tricks.  On the other hand, requiring that every C implemented method checks the type of self in a type-specific way is probably not feasible either.
History
Date User Action Args
2011-02-04 04:54:19belopolskysetrecipients: + belopolsky, vstinner, eric.araujo, Trundle, flox, meador.inge, daniel.urban
2011-02-04 04:54:19belopolskysetmessageid: <1296795259.01.0.739948825072.issue9756@psf.upfronthosting.co.za>
2011-02-04 04:54:18belopolskylinkissue9756 messages
2011-02-04 04:54:18belopolskycreate