Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:
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. ---------- nosy: +belopolsky _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9756> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com