[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson
Mark Dickinson added the comment: I think consistent behavior between int() and Fraction() is valuable. Agreed. If no-one objects I'll fix the Decimal - Fraction and float - Fraction conversions to match what Decimal - int and float - int currently do (ValueError and OverflowError). Then

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev
Alexey Kachayev added the comment: Patch is attached for {float, Decimal} - {int, Fraction} consistency (with ValueError and OverflowError). Test cases are changed as well. I can also change OverflowError to ValueError for all cases, but I'm not sure should I open for this separated issue or

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469 ___ ___

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev
Alexey Kachayev added the comment: I also attached full_issue patch: change OverflowError to ValueError for all cases. -- Added file: http://bugs.python.org/file27991/full_issues16469.diff ___ Python tracker rep...@bugs.python.org

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev
Changes by Alexey Kachayev kacha...@gmail.com: Added file: http://bugs.python.org/file27992/full_issues16469_fixed.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469 ___

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson
Mark Dickinson added the comment: The first patch looks great (modulo a stray extra line in test_int). Thank you! Let's just apply that for now; I'll open a new issue for the suggested OverflowError / ValueError switch. (Getting rid of the TypeError seems a clear win to me; switching the

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson
Mark Dickinson added the comment: Fixed in http://hg.python.org/cpython/rev/a2b54b6d9759. Thanks for the report and patch. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Mark Dickinson
Mark Dickinson added the comment: See issue #16483 for the ValueError / OverflowError switch. To be honest, while I would have preferred ValueError to OverflowError for int(float('inf')) if we were doing this from scratch, I'm not convinced that it's actually worth switching. --

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-15 Thread Alexey Kachayev
Alexey Kachayev added the comment: Ok, I think that ValueError is more appropriate and I have already attached adopted patch for issue 16483. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- title: Exceptions raised by Fraction() from those raised by int() - Exceptions raised by Fraction() different from those raised by int() ___ Python tracker rep...@bugs.python.org

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Mark Dickinson
Mark Dickinson added the comment: The from_decimal method should be changed as well. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469 ___

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469 ___ ___

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469 ___ ___

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Martin v . Löwis
Martin v. Löwis added the comment: The description of OverflowError is that is is raised when the result of an arithmetic operation is too large to be represented, so it doesn't actually need to overflow. Still, I see that ∞ actually isn't too large to be represented (and the documentation

[issue16469] Exceptions raised by Fraction() different from those raised by int()

2012-11-14 Thread Case Van Horsen
Case Van Horsen added the comment: Do we also want to change int(infinity) to return ValueError? I think consistent behavior between int() and Fraction() is valuable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16469