Skip to content

[3.8] bpo-37150: Throw ValueError if FileType class object was passed in add_argument (GH-13805) #13901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2019

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 7, 2019

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)

https://bugs.python.org/issue37150
(cherry picked from commit 03d5831)

Co-authored-by: zygocephalus [email protected]

https://bugs.python.org/issue37150

…d_argument (pythonGH-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
(cherry picked from commit 03d5831)

Co-authored-by: zygocephalus <[email protected]>
@miss-islington
Copy link
Contributor Author

@zygocephalus: Status check is done, and it's a success ✅ .

2 similar comments
@miss-islington
Copy link
Contributor Author

@zygocephalus: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@zygocephalus: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 606ac58 into python:3.8 Jun 7, 2019
@miss-islington miss-islington deleted the backport-03d5831-3.8 branch June 7, 2019 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants