Skip to content
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

bpo-37150: Throw ValueError if FileType class object was passed in add_argument #13805

Merged
merged 2 commits into from
Jun 7, 2019

Conversation

0x29a
Copy link
Contributor

@0x29a 0x29a commented Jun 4, 2019

There is a possibility that someone (like me) can accidentally omit parentheses with FileType arguments after FileType, and the 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

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@0x29a 0x29a changed the title bpo-37150: Throw ValueError if Filetype class object was passed in add_argument bpo-37150: Throw ValueError if FileType class object was passed in add_argument Jun 4, 2019
@miss-islington
Copy link
Contributor

Thanks @zygocephalus for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-13901 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Jun 7, 2019
…d_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
(cherry picked from commit 03d5831)

Co-authored-by: zygocephalus <grrrr@protonmail.com>
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…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
@0x29a 0x29a deleted the fix-issue-37150 branch October 1, 2023 22:47
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.

6 participants