diff options
author | zygocephalus <grrrr@protonmail.com> | 2019-06-07 20:08:36 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-07 20:08:36 (GMT) |
commit | 03d5831a2d62c68654ec223168e574cd546efbf6 (patch) | |
tree | e1d26a353a8269cfaf0fd2f1518bf7907c16f116 /Misc | |
parent | 1f9531764cc0f8dbca1d8f429d162dc28282f4b4 (diff) | |
download | cpython-03d5831a2d62c68654ec223168e574cd546efbf6.zip cpython-03d5831a2d62c68654ec223168e574cd546efbf6.tar.gz cpython-03d5831a2d62c68654ec223168e574cd546efbf6.tar.bz2 |
bpo-37150: Throw ValueError if FileType class object was passed in add_argument (GH-13805)
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:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```
https://bugs.python.org/issue37150
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-06-04-14-44-41.bpo-37150.TTzHxj.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-06-04-14-44-41.bpo-37150.TTzHxj.rst b/Misc/NEWS.d/next/Library/2019-06-04-14-44-41.bpo-37150.TTzHxj.rst new file mode 100644 index 0000000..c5be46e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-06-04-14-44-41.bpo-37150.TTzHxj.rst @@ -0,0 +1 @@ +`argparse._ActionsContainer.add_argument` now throws error, if someone accidentally pass FileType class object instead of instance of FileType as `type` argument
\ No newline at end of file |