Skip to content

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

Merged
miss-islington merged 2 commits into
python:masterfrom
0x29a:fix-issue-37150
Jun 7, 2019
Merged

bpo-37150: Throw ValueError if FileType class object was passed in add_argument#13805
miss-islington merged 2 commits into
python:masterfrom
0x29a:fix-issue-37150

Conversation

@0x29a

@0x29a 0x29a commented Jun 4, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
Contributor

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

@bedevere-bot

Copy link
Copy Markdown

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