fractions.gcd deprecated in python 3.9

Bug #1922745 reported by marco zaro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MadGraph5_aMC@NLO
Fix Released
Undecided
Unassigned

Bug Description

Hi Olivier,
we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
https://bugs.python.org/issue39350
Cheers,

Marco

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote : Re: [Bug 1922745] [NEW] fractions.gcd deprecated in python 3.9

Are you sure that we still use it?

I'm running python3.9 without any issue so far (and indeed I remember having fixed stuff in that direction)

Cheers,

Olivier

> On 6 Apr 2021, at 17:02, marco zaro <email address hidden> wrote:
>
> Public bug reported:
>
> Hi Olivier,
> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
> https://bugs.python.org/issue39350
> Cheers,
>
> Marco
>
> ** Affects: mg5amcnlo
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to
> MadGraph5_aMC@NLO.
> https://bugs.launchpad.net/bugs/1922745
>
> Title:
> fractions.gcd deprecated in python 3.9
>
> Status in MadGraph5_aMC@NLO:
> New
>
> Bug description:
> Hi Olivier,
> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
> https://bugs.python.org/issue39350
> Cheers,
>
> Marco
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mg5amcnlo/+bug/1922745/+subscriptions

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

In the code I see:

        if six.PY2:
            return a * b // fractions.gcd(a, b)
        else:
            return a * b // math.gcd(a, b)

so this is correctly handle.

I see however this line:

./iolibs/export_v4.py:1262: commondenom=abs(reduce(fractions.gcd, coefs_list).denominator)

where it seems not correctly protected but It seems that the full function is set to be removed.

Cheers,

Olivier

> On 6 Apr 2021, at 17:12, Olivier Mattelaer <email address hidden> wrote:
>
> Are you sure that we still use it?
>
> I'm running python3.9 without any issue so far (and indeed I remember having fixed stuff in that direction)
>
> Cheers,
>
> Olivier
>
>> On 6 Apr 2021, at 17:02, marco zaro <email address hidden> wrote:
>>
>> Public bug reported:
>>
>> Hi Olivier,
>> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
>> https://bugs.python.org/issue39350
>> Cheers,
>>
>> Marco
>>
>> ** Affects: mg5amcnlo
>> Importance: Undecided
>> Status: New
>>
>> --
>> You received this bug notification because you are subscribed to
>> MadGraph5_aMC@NLO.
>> https://bugs.launchpad.net/bugs/1922745
>>
>> Title:
>> fractions.gcd deprecated in python 3.9
>>
>> Status in MadGraph5_aMC@NLO:
>> New
>>
>> Bug description:
>> Hi Olivier,
>> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
>> https://bugs.python.org/issue39350
>> Cheers,
>>
>> Marco
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/mg5amcnlo/+bug/1922745/+subscriptions
>

Revision history for this message
marco zaro (marco-zaro) wrote :

Ok, right. So probably our problem will be solved once we merge the branch we are using (3.0.4-sudakov) with the most recent ones.

Thanks, and sorry for the noise.

marco

> On 6 Apr 2021, at 17:22, Olivier Mattelaer <email address hidden> wrote:
>
> In the code I see:
>
> if six.PY2:
> return a * b // fractions.gcd(a, b)
> else:
> return a * b // math.gcd(a, b)
>
> so this is correctly handle.
>
> I see however this line:
>
> ./iolibs/export_v4.py:1262:
> commondenom=abs(reduce(fractions.gcd, coefs_list).denominator)
>
> where it seems not correctly protected but It seems that the full
> function is set to be removed.
>
> Cheers,
>
> Olivier
>
>
>> On 6 Apr 2021, at 17:12, Olivier Mattelaer <email address hidden> wrote:
>>
>> Are you sure that we still use it?
>>
>> I'm running python3.9 without any issue so far (and indeed I remember having fixed stuff in that direction)
>>
>> Cheers,
>>
>> Olivier
>>
>>> On 6 Apr 2021, at 17:02, marco zaro <email address hidden> wrote:
>>>
>>> Public bug reported:
>>>
>>> Hi Olivier,
>>> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
>>> https://bugs.python.org/issue39350
>>> Cheers,
>>>
>>> Marco
>>>
>>> ** Affects: mg5amcnlo
>>> Importance: Undecided
>>> Status: New
>>>
>>> --
>>> You received this bug notification because you are subscribed to
>>> MadGraph5_aMC@NLO.
>>> https://bugs.launchpad.net/bugs/1922745
>>>
>>> Title:
>>> fractions.gcd deprecated in python 3.9
>>>
>>> Status in MadGraph5_aMC@NLO:
>>> New
>>>
>>> Bug description:
>>> Hi Olivier,
>>> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
>>> https://bugs.python.org/issue39350
>>> Cheers,
>>>
>>> Marco
>>>
>>> To manage notifications about this bug go to:
>>> https://bugs.launchpad.net/mg5amcnlo/+bug/1922745/+subscriptions
>>
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1922745
>
> Title:
> fractions.gcd deprecated in python 3.9
>
> Status in MadGraph5_aMC@NLO:
> New
>
> Bug description:
> Hi Olivier,
> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
> https://bugs.python.org/issue39350
> Cheers,
>
> Marco
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mg5amcnlo/+bug/1922745/+subscriptions

Changed in mg5amcnlo:
status: New → Fix Released
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote : Re: [Bug 1922745] fractions.gcd deprecated in python 3.9

Just to comment that i have tested 3.10a7 and simple run and unittest are working as expected without any crash (and i did not spot any Depreciation warning)

> On 7 Apr 2021, at 10:03, Olivier Mattelaer <email address hidden> wrote:
>
> ** Changed in: mg5amcnlo
> Status: New => Fix Released
>
> --
> You received this bug notification because you are subscribed to
> MadGraph5_aMC@NLO.
> https://bugs.launchpad.net/bugs/1922745
>
> Title:
> fractions.gcd deprecated in python 3.9
>
> Status in MadGraph5_aMC@NLO:
> Fix Released
>
> Bug description:
> Hi Olivier,
> we should remove the calls to fractions.gcd in the code, as it is deprecated from python 3.9
> https://bugs.python.org/issue39350
> Cheers,
>
> Marco
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mg5amcnlo/+bug/1922745/+subscriptions

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.