veeresht / CommPy

Digital Communication with Python
http://veeresht.github.com/CommPy
BSD 3-Clause "New" or "Revised" License
551 stars 179 forks source link

ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib64/python3.9/fractions.py) #96

Closed captcha1 closed 3 years ago

captcha1 commented 3 years ago

In Python 3.9 , "gcd" is deprecated : https://docs.python.org/3.5/library/fractions.html#fractions.gcd

Fix :

$ diff commpy/channelcoding/gfields.py*
6c6
< #from fractions import gcd
---
> from fractions import gcd
112c112
<             orders[idx] = (2**self.m - 1)/(math.gcd(i, 2**self.m-1))
---
>             orders[idx] = (2**self.m - 1)/(gcd(i, 2**self.m-1))
BastienTr commented 3 years ago

Thanks for the feedback and the suggested fix :+1: