Commit ef52fca5 authored by Florent Jaillet's avatar Florent Jaillet
Browse files

Modify fractions.gcd() import in lcm due to deprecation in Python 3.5

According to the documentation of Python 3.5, the function fractions.gcd()
is deprecated and should be replaced by math.gcd().

So we modify the import of gcd() in lcm.py to import it from the math
module when possible, keeping the import from the fractions module if not
possible in order to keep the compatibility with older versions of Python.
parent 646c23dc
......@@ -6,8 +6,14 @@
from __future__ import print_function, division
from fractions import gcd
from math import copysign
try:
from math import gcd
except ImportError:
# fractions.gcd() is deprecated since Python 3.5 and math.gcd() should be
# used instead, but for backward compatibilty we use fractions.gcd() if
# math.gcd() is not available
from fractions import gcd
def lcm(X, Y):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment