Mark Dickinson <dicki...@gmail.com> added the comment: Problem confirmed here; thanks for the report.
I think it's also a bug that after: class A(object): def __long__(self): return 42 long(A()) returns an object of type 'int' rather than an object of type 'long'. It's inconsistent with what happens with __trunc__, too: >>> class A(object): ... def __trunc__(self): return 42 ... [37198 refs] >>> long(A()) 42L [37201 refs] What's a little bit odd is that there's a test for the __long__-returning-int behaviour in test_class that asserts the return type should be int. Here's a patch that fixes the return type of long (and PyNumber_Long) to be long in these cases. ---------- keywords: +patch Added file: http://bugs.python.org/file18918/issue9869.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9869> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com