New submission from Axel <p...@jejajo.de>:
Example source: from argparse import ArgumentParser, SUPPRESS ============== parser = ArgumentParser() parser.add_argument('i', nargs='?', type=int, default=SUPPRESS) args = parser.parse_args([]) ============== results in: error: argument integer: invalid int value: '==SUPPRESS==' Expected: args = Namespace() In Lib/argparse.py: line 2399 in _get_value: result = type_func(arg_string) with arg_string = SUPPRESS = '==SUPPRESS==' called by ... line 1836 in take_action: argument_values = self._get_values(action, argument_strings) which is done before checking for SUPPRESS in line 1851: if argument_values is not SUPPRESS: action(...) ---------- components: Library (Lib) messages: 336314 nosy: n8falke priority: normal severity: normal status: open title: argparse: positional with type=int, default=SUPPRESS raise ValueError type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36078> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com