Closed Bug 1966090 Opened 7 months ago Closed 7 months ago

Argparse failure when running mozperftest in python 3.13

Categories

(Testing :: mozperftest, defect, P3)

defect

Tracking

(firefox140 fixed)

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: sparky, Assigned: sparky)

References

Details

(Whiteboard: [fxp])

Attachments

(1 file)

The following failure happens when using python 3.13:

TypeError: PerftestArgumentParser._parse_known_args() takes 3 positional arguments but 4 were given

  File "E:\mozilla\firefox\gecko-dev\python\mach\mach\main.py", line 267, in run
    return self._run(argv)
           ~~~~~~~~~^^^^^^
  File "E:\mozilla\firefox\gecko-dev\python\mach\mach\main.py", line 328, in _run
    args = parser.parse_args(argv)
  File "C:\Python313\Lib\argparse.py", line 1889, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\argparse.py", line 1899, in parse_known_args
    return self._parse_known_args2(args, namespace, intermixed=False)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\argparse.py", line 1928, in _parse_known_args2
    namespace, args = self._parse_known_args(args, namespace, intermixed)
                      ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\argparse.py", line 2183, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "C:\Python313\Lib\argparse.py", line 2135, in consume_positionals
    take_action(action, args)
    ~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Python313\Lib\argparse.py", line 2004, in take_action
    action(self, namespace, argument_values, option_string)
    ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\mozilla\firefox\gecko-dev\python\mach\mach\dispatcher.py", line 216, in __call__
    command_namespace, extra = subparser.parse_known_args(args)
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "e:\mozilla\firefox\gecko-dev\python\mozperftest\mozperftest\argparser.py", line 209, in parse_known_args
    return super().parse_known_args(args, namespace)
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\argparse.py", line 1899, in parse_known_args
    return self._parse_known_args2(args, namespace, intermixed=False)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\argparse.py", line 1928, in _parse_known_args2
    namespace, args = self._parse_known_args(args, namespace, intermixed)

This patch fixes an issue on mozperftest when running it with python 3.13+. It relates to a new parameter that has been added in python 3.13, and that does not exist in earlier versions (hence the version check).

Assignee: nobody → gmierz2
Status: NEW → ASSIGNED

Abhishek and I encountered this on 3.12 as well

If you apply the patch in this bug, and change the version check to > 11 does it fix the issue?

Flags: needinfo?(kshampur)

Yup looks like it!

Flags: needinfo?(kshampur)
Attachment #9487292 - Attachment description: Bug 1966090 - Pass intermixed argument to _parse_known_args on python 3.13+. r?#perftest → Bug 1966090 - Pass intermixed argument to _parse_known_args on python 3.12+. r?#perftest
Pushed by gmierz2@outlook.com: https://hg.mozilla.org/integration/autoland/rev/fa298063bd96 Pass intermixed argument to _parse_known_args on python 3.12+. r=perftest-reviewers,afinder
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
Regressions: 1968159
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: