[issue39274] Conversion from fractions.Fraction to bool

2020-02-06 Thread miss-islington
miss-islington added the comment: New changeset 705d271d553b77fd170d27ab8d0f11f638c7f145 by Miss Islington (bot) in branch '3.7': bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017) https://github.com/python/cpython/commit/705d271d553b77fd170d27ab8d0f11f638c7f145 -- ___

[issue39274] Conversion from fractions.Fraction to bool

2020-02-06 Thread miss-islington
miss-islington added the comment: New changeset 0d03a1028200646479ef9bb0ad8973d0e73f9525 by Miss Islington (bot) in branch '3.8': bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017) https://github.com/python/cpython/commit/0d03a1028200646479ef9bb0ad8973d0e73f9525 -- nosy

[issue39274] Conversion from fractions.Fraction to bool

2020-02-06 Thread STINNER Victor
STINNER Victor added the comment: Thanks Sebastian Berg for the fix, and thanks François Durand for the bug report! This issue is fixed in the master branch, and backports to 3.7 and 3.8 will land soon automatically (once the CI tests pass). -- resolution: -> fixed stage: patch revie

[issue39274] Conversion from fractions.Fraction to bool

2020-02-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +17754 pull_request: https://github.com/python/cpython/pull/18377 ___ Python tracker ___ __

[issue39274] Conversion from fractions.Fraction to bool

2020-02-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +17753 pull_request: https://github.com/python/cpython/pull/18376 ___ Python tracker ___ __

[issue39274] Conversion from fractions.Fraction to bool

2020-02-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset 427c84f13f7719e6014a21bd1b81efdc02a046fb by Sebastian Berg in branch 'master': bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017) https://github.com/python/cpython/commit/427c84f13f7719e6014a21bd1b81efdc02a046fb -- __

[issue39274] Conversion from fractions.Fraction to bool

2020-02-02 Thread SilentGhost
SilentGhost added the comment: "Successful" PR would be merged into master. This issue is still in "patch review" stage. -- nosy: +SilentGhost ___ Python tracker ___

[issue39274] Conversion from fractions.Fraction to bool

2020-02-02 Thread Ido Michael
Ido Michael added the comment: Hi all, I think this issue can be closed right? Saw a successful PR. -- nosy: +Ido Michael ___ Python tracker ___ _

[issue39274] Conversion from fractions.Fraction to bool

2020-01-15 Thread Sebastian Berg
Change by Sebastian Berg : -- keywords: +patch pull_requests: +17412 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18017 ___ Python tracker ___ _

[issue39274] Conversion from fractions.Fraction to bool

2020-01-15 Thread STINNER Victor
STINNER Victor added the comment: Does someone want to propose a PR to modify fractions.Fraction.__bool__() to use "return bool(a._numerator)"? -- keywords: +newcomer friendly versions: -Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tr

[issue39274] Conversion from fractions.Fraction to bool

2020-01-10 Thread Terry J. Reedy
Change by Terry J. Reedy : -- Removed message: https://bugs.python.org/msg359674 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread Sebastian Berg
Sebastian Berg added the comment: Thanks for the quick responses. @Victor Stinner, I suppose you could change `numbers.Complex.__bool__()` by adding the no-op bool to make it: `bool(self != 0)`. But I am not sure I feel it is necessary. NumPy is a bit a strange in that it uses its own boole

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread STINNER Victor
STINNER Victor added the comment: > ``return bool(a._numerator)`` does seem like the obvious way to do this. Yes, it's a good fix. It's used on other places. -- numbers.Complex.__bool__() also uses "self != 0". Is it an issue? -- nosy: +vstinner

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread Mark Dickinson
Mark Dickinson added the comment: For completeness and to save people going to the NumPy tracker, here's an example of the problem: Python 3.8.1 (default, Jan 5 2020, 21:32:35) [Clang 10.0.1 (clang-1001.0.46.4)] on darwin Type "help", "copyright", "credits" or "license" for more information

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread Mark Dickinson
Mark Dickinson added the comment: Agreed that __bool__ should return an actual bool. ``return bool(a._numerator)`` does seem like the obvious way to do this. -- ___ Python tracker ___

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +mark.dickinson, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread François Durand
François Durand added the comment: As of now, fractions.Fraction.__bool__ is implemented as: ``return a._numerator != 0``. However, this does not necessary return a bool (which would be desired). In particular, when the numerator is a numpy integer, this returns a numpy bool instead. Another

[issue39274] Conversion from fractions.Fraction to bool

2020-01-09 Thread François Durand
New submission from François Durand : As of now, fractions.Fraction.__bool__ is implemented as: ``return a._numerator != 0``. However, this does not necessary return a bool (which would be desired). In particular, when the numerator is a numpy integer, this returns a numpy bool instead. Anothe