Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: You are right: long(4.2) used to return a long.
This was changed by the introduction of the float_trunc() function, which is now used for float.__trunc__, float.__int__ and float.__long__. OTOH, long() has always been allowed to return an int. Checked with python2.2: >>> class C: ... def __long__(self): return 4 ... >>> type(long(C())) <type 'int'> I suggest that: - your code should be more tolerant, specially when calling API functions from the "Abstract Objects Layer", accept both longs and ints. - Concerning long(float()), the new behavior breaks existing code, and should be reverted. I will try to come with a patch. ---------- priority: -> release blocker title: PyNumber_Long fails from Float -> long(4.2) now returns an int _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3777> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com