homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: argparse crashes with AssertionError
Type: crash Stage: resolved
Components: Distutils Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: argparse assertion failure with brackets in metavars
View: 11874
Assigned To: Nosy List: dstufft, eric.araujo, miss-islington, ncoghlan, paul.j3, spaceone
Priority: normal Keywords:

Created on 2015年05月01日 04:45 by spaceone, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7527 closed miss-islington, 2018年06月08日 10:14
PR 7528 merged miss-islington, 2018年06月08日 10:14
PR 7530 merged miss-islington, 2018年06月08日 11:11
PR 7553 merged miss-islington, 2018年06月09日 01:19
Messages (6)
msg242299 - (view) Author: SpaceOne (spaceone) * Date: 2015年05月01日 04:45
Just add an argument with metavar='[PROTOCOL://]HOST[:PORT]' ([...] twice in the string) causes the following traceback:
Traceback (most recent call last):
 File "curl.py", line 182, in <module>
 arguments = parser.parse_args()
 File "/usr/lib/python2.7/argparse.py", line 1701, in parse_args
 args, argv = self.parse_known_args(args, namespace)
 File "/usr/lib/python2.7/argparse.py", line 1733, in parse_known_args
 namespace, args = self._parse_known_args(args, namespace)
 File "/usr/lib/python2.7/argparse.py", line 1939, in _parse_known_args
 start_index = consume_optional(start_index)
 File "/usr/lib/python2.7/argparse.py", line 1879, in consume_optional
 take_action(action, args, option_string)
 File "/usr/lib/python2.7/argparse.py", line 1807, in take_action
 action(self, namespace, argument_values, option_string)
 File "/usr/lib/python2.7/argparse.py", line 996, in __call__
 parser.print_help()
 File "/usr/lib/python2.7/argparse.py", line 2340, in print_help
 self._print_message(self.format_help(), file)
 File "/usr/lib/python2.7/argparse.py", line 2314, in format_help
 return formatter.format_help()
 File "/usr/lib/python2.7/argparse.py", line 281, in format_help
 help = self._root_section.format_help()
 File "/usr/lib/python2.7/argparse.py", line 211, in format_help
 func(*args)
 File "/usr/lib/python2.7/argparse.py", line 332, in _format_usage
 assert ' '.join(opt_parts) == opt_usage
AssertionError
msg242449 - (view) Author: paul j3 (paul.j3) * (Python triager) Date: 2015年05月03日 04:08
It's the spaces and/or brackets in the metavar, along with a usage line that is long enough to wrap, that is raising this error.
It's a known problem.
http://bugs.python.org/issue11874 
msg319039 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2018年06月08日 10:12
New changeset 66f02aa32f1e4adb9f24cf186f8c495399d5ce9b by Nick Coghlan (wim glenn) in branch 'master':
bpo-11874: fix assertion failure in argparse metavar handling (GH-1826)
https://github.com/python/cpython/commit/66f02aa32f1e4adb9f24cf186f8c495399d5ce9b
msg319048 - (view) Author: miss-islington (miss-islington) Date: 2018年06月08日 11:06
New changeset 376c272d68cca0975ff0be3d12abf5f67da342d7 by Miss Islington (bot) in branch '3.6':
bpo-11874: fix assertion failure in argparse metavar handling (GH-1826)
https://github.com/python/cpython/commit/376c272d68cca0975ff0be3d12abf5f67da342d7
msg319052 - (view) Author: miss-islington (miss-islington) Date: 2018年06月08日 11:33
New changeset 842985f6c70484ed7b8fc30d0bc05aec73236a98 by Miss Islington (bot) in branch '3.7':
bpo-11874: fix assertion failure in argparse metavar handling (GH-1826)
https://github.com/python/cpython/commit/842985f6c70484ed7b8fc30d0bc05aec73236a98
msg319125 - (view) Author: miss-islington (miss-islington) Date: 2018年06月09日 01:28
New changeset 4e6bd247aa955056626bf0cf8dc1c65a587b871f by Miss Islington (bot) in branch '2.7':
bpo-11874: fix assertion failure in argparse metavar handling (GH-1826)
https://github.com/python/cpython/commit/4e6bd247aa955056626bf0cf8dc1c65a587b871f
History
Date User Action Args
2022年04月11日 14:58:16adminsetgithub: 68277
2018年06月09日 01:28:05miss-islingtonsetmessages: + msg319125
2018年06月09日 01:19:25miss-islingtonsetpull_requests: + pull_request7186
2018年06月08日 11:33:53miss-islingtonsetmessages: + msg319052
2018年06月08日 11:11:23miss-islingtonsetpull_requests: + pull_request7167
2018年06月08日 11:06:01miss-islingtonsetnosy: + miss-islington
messages: + msg319048
2018年06月08日 10:14:59miss-islingtonsetpull_requests: + pull_request7161
2018年06月08日 10:14:00miss-islingtonsetpull_requests: + pull_request7157
2018年06月08日 10:12:52ncoghlansetnosy: + ncoghlan
messages: + msg319039
2015年05月05日 21:06:35ned.deilysetstatus: open -> closed
superseder: argparse assertion failure with brackets in metavars
resolution: duplicate
stage: resolved
2015年05月03日 04:08:46paul.j3setnosy: + paul.j3
messages: + msg242449
2015年05月01日 04:45:58spaceonecreate

AltStyle によって変換されたページ (->オリジナル) /