[issue39350] Remove deprecated fractions.gcd()

2020-02-07 Thread STINNER Victor
STINNER Victor added the comment: Thanks Miro for the bug report and thanks Mark for the great review and discussion! It should now be fixed. I tested manually that my change fix numpy test suite. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed __

[issue39350] Remove deprecated fractions.gcd()

2020-02-07 Thread STINNER Victor
STINNER Victor added the comment: New changeset dc7a50d73a3d16918529669ff7b8783c08cff090 by Victor Stinner in branch 'master': bpo-39350: Fix fractions for int subclasses (GH-18375) https://github.com/python/cpython/commit/dc7a50d73a3d16918529669ff7b8783c08cff090 -- ___

[issue39350] Remove deprecated fractions.gcd()

2020-02-06 Thread STINNER Victor
STINNER Victor added the comment: FYI the full numpy test suite pass with PR 18375: (env) vstinner@apu$ python runtests.py -v (...) === 9879 passed, 443 skipped, 180 deselected, 17 xfailed, 3 xpassed in 305.17s (0:05:05) === -- __

[issue39350] Remove deprecated fractions.gcd()

2020-02-06 Thread STINNER Victor
STINNER Victor added the comment: I managed to test my PR with numpy: $ env/bin/python >>> import fractions >>> import numpy >>> f=fractions.Fraction(numpy.int64(1*3), numpy.int64(2*3)) >>> f Fraction(1, 2) >>> type(f.numerator) >>> type(f.denominator) So it works as expected: numerator an

[issue39350] Remove deprecated fractions.gcd()

2020-02-06 Thread STINNER Victor
STINNER Victor added the comment: I tried but failed to write a test to mimick numpy.int64 type. I tried to build a type which implements numbers.Rational but don't inherit from int, but there are way too many methods that I have to implement :-( Morever, installing numpy on a Python 3.9 vir

[issue39350] Remove deprecated fractions.gcd()

2020-02-06 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +17751 pull_request: https://github.com/python/cpython/pull/18375 ___ Python tracker ___ __

[issue39350] Remove deprecated fractions.gcd()

2020-02-02 Thread Mark Dickinson
Mark Dickinson added the comment: Apologies, I think I moved the discussion off-track. The first order of business should be to fix the regression. We can discuss behaviour changes after that. I've opened GH-18309 as a quick fix for the regression. -- __

[issue39350] Remove deprecated fractions.gcd()

2020-02-02 Thread Mark Dickinson
Change by Mark Dickinson : -- pull_requests: +17685 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/18309 ___ Python tracker ___ __

[issue39350] Remove deprecated fractions.gcd()

2020-01-31 Thread Miro Hrončok
Miro Hrončok added the comment: Naively implementing this code, I'd use isinstance(numerator, int) over type(numerator) is int. Is that strict type check really needed? I could not find anywhere whether numerator and denominator of numbers.Rational need to be numbers.Integral. I would expect

[issue39350] Remove deprecated fractions.gcd()

2020-01-31 Thread Mark Dickinson
Mark Dickinson added the comment: The relevant piece of Python code from fractions.py looks like this: if type(numerator) is int is type(denominator): # *very* normal case g = math.gcd(numerator, denominator) if denominator < 0: g = -g else:

[issue39350] Remove deprecated fractions.gcd()

2020-01-31 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue39350] Remove deprecated fractions.gcd()

2020-01-31 Thread Miro Hrončok
Miro Hrončok added the comment: Reproducer: class myint(int): def __mul__(self, other): return type(self)(int(self)*int(other)) @property def numerator(self): return type(self)(super().numerator) @property def denominator(self): return type(self)(supe

[issue39350] Remove deprecated fractions.gcd()

2020-01-31 Thread Miro Hrončok
Miro Hrončok added the comment: I believe there is a regression here. numpy fails to build with Python 3.9.0a3. TestMatmul.test_matmul_object _ self = def test_matmul_object(self): import fractions f = np.vectorize(frac

[issue39350] Remove deprecated fractions.gcd()

2020-01-16 Thread STINNER Victor
Change by STINNER Victor : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue39350] Remove deprecated fractions.gcd()

2020-01-16 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4691a2f2a2b8174a6c958ce6976ed5f3354c9504 by Victor Stinner in branch 'master': bpo-39350: Remove deprecated fractions.gcd() (GH-18021) https://github.com/python/cpython/commit/4691a2f2a2b8174a6c958ce6976ed5f3354c9504 -- __

[issue39350] Remove deprecated fractions.gcd()

2020-01-16 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +17416 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18021 ___ Python tracker ___ _

[issue39350] Remove deprecated fractions.gcd()

2020-01-16 Thread STINNER Victor
New submission from STINNER Victor : bpo-22486 added math.gcd() and deprecated fractions.gcd() in Python 3.5: commit 48e47aaa28d6dfdae128142ffcbc4b0642422e90. The function was deprecated during 4 cycles (3.5, 3.6, 3.7, 3.8): I propose attached PR to remove it. -- components: Library