[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-03 Thread Mark Dickinson
New submission from Mark Dickinson <[EMAIL PROTECTED]>: In Python 3.0, the Decimal __round__, __ceil__ and __floor__ functions don't work as intended: they all return 1, 0, or -1. This is easy to fix. The only reason I'm making an issue (literally) of it is that I remember some discussion of

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-03 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: I remember the answer being that they shouldn't be supported, but then I stopped paying attention and some patches went in bringing Decimal closer to the Real API again, so I'm not sure if the earlier discussion still applies. I'm happy to le

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-03 Thread Raymond Hettinger
Changes by Raymond Hettinger <[EMAIL PROTECTED]>: -- assignee: facundobatista -> rhettinger __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-li

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-03 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: I've removed __round__, __ceil__ and __floor__ in r62669; the code was undocumented, untested and just plain wrong, so there doesn't seem to be any point in leaving it in. (I'm not quite sure how it got there in the first place.) This st

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-03 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Thanks Mark. I'll review your patch when it's ready. __ Tracker <[EMAIL PROTECTED]> __ ___ Pyth

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-03 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Here's a patch that implements __ceil__, __floor__ and __round__. (It seems that just removing __ceil__, __floor__ and __round__ is not an option, as I just discovered when r62669 turned all the buildbots red.) Points to note: (1) Two-arg

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-04 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: The patch basically looks good. The signature for __round__() should not grow beyond the spec for the built-in round() function that calls it: round(x[, n]). The context and rounding arguments are not part of that API. Just like __in

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-04 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Here's a revised patch, with the following changes - no keyword arguments to round - check that the second argument to round is an integer. Added file: http://bugs.python.org/file10188/decimal_ceilfloor2.patch

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-04 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Thanks for the patch. Please apply. -- resolution: -> accepted __ Tracker <[EMAIL PROTECTED]> __

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-08 Thread Raymond Hettinger
Changes by Raymond Hettinger <[EMAIL PROTECTED]>: -- assignee: rhettinger -> marketdickinson __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-l

[issue2748] ceil(), floor() and round() broken in Decimal

2008-05-09 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Thanks for reviewing this, Raymond! Committed, r62938. -- status: open -> closed __ Tracker <[EMAIL PROTECTED]> __ __