[issue27936] Inconsistent round behavior between float and int

2016-09-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7108f2a708c9 by Raymond Hettinger in branch '3.5': Issue 27936: Update doc for round() to indicate that None is an allowable argument. https://hg.python.org/cpython/rev/7108f2a708c9 -- ___ Python tracker

[issue27936] Inconsistent round behavior between float and int

2016-09-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset c3c4d8e4ca1a by Raymond Hettinger in branch '3.5': Issue 27936: Fix inconsistent round() behavior between float and int https://hg.python.org/cpython/rev/c3c4d8e4ca1a -- nosy: +python-dev ___ Python track

[issue27936] Inconsistent round behavior between float and int

2016-09-03 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger resolution: -> fixed status: open -> closed versions: +Python 3.6 ___ Python tracker ___ _

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Mark Dickinson
Mark Dickinson added the comment: For the record, the float behaviour was changed (for Python 3.5) in http://bugs.python.org/issue19933. There didn't seem to be any particularly strong motivation for that change, but it's done now. -- ___ Python tra

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Mark Dickinson
Mark Dickinson added the comment: The test could be strengthened to add a check that the types of `round(x)` and `round(x, None)` match. -- ___ Python tracker ___ __

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Mark Dickinson
Mark Dickinson added the comment: Ah, sorry; now that I've looked at the patch, I see I misunderstood. You're not replacing None with zero; you're replacing it with NULL. Patch LGTM. -- ___ Python tracker ___

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Mark Dickinson
Mark Dickinson added the comment: > I think the round() function should explicitly check for None and replace it > with zero That would be a change in behaviour: `round(x)` is not the same as `round(x, 0)`. For most types, `round(x)` returns an `int`, while `round(x, 0)` returns something of

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file44342/fix_round_default_none_with_test.diff ___ Python tracker ___ ___

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : Removed file: http://bugs.python.org/file44341/fix_round_default_none.diff ___ Python tracker ___ ___ Python-bu

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- keywords: +patch Added file: http://bugs.python.org/file44341/fix_round_default_none.diff ___ Python tracker ___ ___

[issue27936] Inconsistent round behavior between float and int

2016-09-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: The different data types make different choices: >>> from decimal import Decimal >>> from fractions import Fraction >>> (1).__round__(None) Traceback (most recent call last): File "", line 1, in (1).__round__(None) TypeError: 'NoneType' object cannot b

[issue27936] Inconsistent round behavior between float and int

2016-09-01 Thread Jonatan Skogsfors
New submission from Jonatan Skogsfors: Theo error handling for round is different for float and int. Python 3.5.1 (default, Apr 18 2016, 11:46:32) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> round