Python3.11: "glance-manage" crashes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Removing a lot of the output since Launchpad is not going to format it properly anyway:
$ glance-manage -h
...
argparse.
This happens because the argparse module became stricter in Python3.11 and prevents us from adding the same subparser twice:
$ cat parser.py
import argparse
parser = argparse.
subparsers = parser.
subparsers.
subparsers.
subparsers.
parser.parse_args()
$ python3.10 parser.py
$ python3.11 parser.py
Traceback (most recent call last):
File "/tmp/parser.py", line 6, in <module>
subparsers.
File "/usr/lib/
raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.
$
Changed in glance: | |
status: | New → In Progress |
Reviewed: https:/ /review. opendev. org/c/openstack /glance/ +/850589 /opendev. org/openstack/ glance/ commit/ 76abb227addf1ae 44813527084d1ce b7f36af606
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 76abb227addf1ae 44813527084d1ce b7f36af606
Author: Cyril Roelandt <email address hidden>
Date: Thu Jul 21 00:16:20 2022 +0200
glance-manage: fix crash under Python3.11
In Python3.11, the argparse module became stricter. While the following ArgumentError because we added the same subparser twice:
code was fine in previous versions, it will now raise an
argparse.
import argparse ArgumentParser( ) add_subparsers( title=' Commands' ) add_parser( 'foo') add_parser( 'foo') add_parser( 'bar') parse_args( )
parser = argparse.
subparsers = parser.
subparsers.
subparsers.
subparsers.
parser.
This mistake was silently ignore in Python3.10, which explains why this
was never an issue for glance-manage.
Closes-Bug: #1982426 553f03b0b8ba44e fbef976ffb0
Change-Id: I3a88ab5d2e67a1