[issue37150] Do not allow to pass FileType class object instead of instance in add_argument

Demid report at bugs.python.org
Tue Jun 4 09:22:00 EDT 2019


New submission from Demid <grrrr at protonmail.com>:

There is a possibility that someone (like me) accidentally will omit parentheses with FileType arguments after FileType, and parser will contain wrong file until someone will try to use it. 

Example:
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)

----------
components: Library (Lib)
messages: 344568
nosy: zygocephalus
priority: normal
severity: normal
status: open
title: Do not allow to pass FileType class object instead of instance in add_argument
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37150>
_______________________________________


More information about the Python-bugs-list mailing list