Message127869
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. |
|
Date |
User |
Action |
Args |
2011-02-04 04:54:19 | belopolsky | set | recipients:
+ belopolsky, vstinner, eric.araujo, Trundle, flox, meador.inge, daniel.urban |
2011-02-04 04:54:19 | belopolsky | set | messageid: <1296795259.01.0.739948825072.issue9756@psf.upfronthosting.co.za> |
2011-02-04 04:54:18 | belopolsky | link | issue9756 messages |
2011-02-04 04:54:18 | belopolsky | create | |
|