Issue #9026: Fix order of argparse sub-commands in help messages. (Merged from 3.2.)
diff --git a/Lib/argparse.py b/Lib/argparse.py
index d4e691d..5b5598f 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -82,6 +82,7 @@
]
+import collections as _collections
import copy as _copy
import os as _os
import re as _re
@@ -1037,7 +1038,7 @@
self._prog_prefix = prog
self._parser_class = parser_class
- self._name_parser_map = {}
+ self._name_parser_map = _collections.OrderedDict()
self._choices_actions = []
super(_SubParsersAction, self).__init__(