Skip to content

Use math.gcd instead of fractions.gcd#226

Merged
jakinyele merged 1 commit intoJHUISI:devfrom
lenerd:lenerd/gcd
Jul 18, 2019
Merged

Use math.gcd instead of fractions.gcd#226
jakinyele merged 1 commit intoJHUISI:devfrom
lenerd:lenerd/gcd

Conversation

@lenerd
Copy link
Copy Markdown
Contributor

@lenerd lenerd commented Jul 8, 2019

Hi there,
while running the charm test I got the following warning (see also Python documentation):

DeprecationWarning: fractions.gcd() is deprecated. Use math.gcd()
instead.

This PR makes the according changes to use math.gcd.

@jakinyele
Copy link
Copy Markdown
Member

@lenerd How about support for py3.4 or below? math.gcd is not available. Please add a check to import

The function fractions.gcd is deprecated since Python 3.5 and math.gcd
should be used instead.  This imports the new math.gcd if available, and
fixes the following warning:

    DeprecationWarning: fractions.gcd() is deprecated. Use math.gcd()
    instead.
@lenerd
Copy link
Copy Markdown
Contributor Author

lenerd commented Jul 10, 2019

Should have thought about this, sorry ... I have added guards for the imports.

Note that the recently released version 5.0 of pytest only supports Python 3.5 and newer. Tu run tests in a virtual environment with an older Python version, I had to specify pytest<=4.6 in the setup.py.

@jakinyele jakinyele merged commit ea13572 into JHUISI:dev Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants