summaryrefslogtreecommitdiffstats
path: root/Lib/fractions.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-01-16 10:02:51 (GMT)
committerGitHub <noreply@github.com>2020-01-16 10:02:51 (GMT)
commit4691a2f2a2b8174a6c958ce6976ed5f3354c9504 (patch)
tree2d39ff21b819f1da2940d94b574190e89a9cf079 /Lib/fractions.py
parent210c19e3c5b86535a73487fa737752de8eb1d866 (diff)
downloadcpython-4691a2f2a2b8174a6c958ce6976ed5f3354c9504.zip
cpython-4691a2f2a2b8174a6c958ce6976ed5f3354c9504.tar.gz
cpython-4691a2f2a2b8174a6c958ce6976ed5f3354c9504.tar.bz2
bpo-39350: Remove deprecated fractions.gcd() (GH-18021)
Remove fractions.gcd() function, deprecated since Python 3.5 (bpo-22486): use math.gcd() instead.
Diffstat (limited to 'Lib/fractions.py')
-rw-r--r--Lib/fractions.py24
1 files changed, 1 insertions, 23 deletions
diff --git a/Lib/fractions.py b/Lib/fractions.py
index 2e7047a..501f4b7 100644
--- a/Lib/fractions.py
+++ b/Lib/fractions.py
@@ -10,31 +10,9 @@ import operator
import re
import sys
-__all__ = ['Fraction', 'gcd']
+__all__ = ['Fraction']
-
-def gcd(a, b):
- """Calculate the Greatest Common Divisor of a and b.
-
- Unless b==0, the result will have the same sign as b (so that when
- b is divided by it, the result comes out positive).
- """
- import warnings
- warnings.warn('fractions.gcd() is deprecated. Use math.gcd() instead.',
- DeprecationWarning, 2)
- if type(a) is int is type(b):
- if (b or a) < 0:
- return -math.gcd(a, b)
- return math.gcd(a, b)
- return _gcd(a, b)
-
-def _gcd(a, b):
- # Supports non-integers for backward compatibility.
- while b:
- a, b = b, a%b
- return a
-
# Constants related to the hash implementation; hash(x) is based
# on the reduction of x modulo the prime _PyHASH_MODULUS.
_PyHASH_MODULUS = sys.hash_info.modulus