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

2019-06-05 Thread Demid


Demid  added the comment:

What if I will add mode check in FileType.__init__?

--

___
Python tracker 
<https://bugs.python.org/issue37150>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-06-04 Thread Demid

Demid  added the comment:

If you will run `python test.py hello.txt, where test.py is:

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('echo', type=argparse.FileType)
args = parser.parse_args()
print(args.echo)

You will receive:
FileType('hello.txt')

I think that can be confusing for someone who will forget to invoke FileType 
constructor.

‐‐‐ Original Message ‐‐‐
On Tuesday, June 4, 2019 10:27 PM, Michele Angrisano  
wrote:

>
>
> Michele angrisanomichele.angris...@gmail.com added the comment:
>
> Reading the examples in the doc, it's clear the behavior when FileType takes 
> an argument. What's the behavior of FileType when is called without any 
> argument?
>
> -
>
> nosy: +mangrisano
>
> Python tracker rep...@bugs.python.org
> https://bugs.python.org/issue37150

--

___
Python tracker 
<https://bugs.python.org/issue37150>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37144] tarfile.open: improper handling of path-like object

2019-06-04 Thread Demid


Change by Demid :


--
keywords: +patch
pull_requests: +13703
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/13817

___
Python tracker 
<https://bugs.python.org/issue37144>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37144] tarfile.open: improper handling of path-like object

2019-06-04 Thread Demid


Change by Demid :


--
nosy: +dm

___
Python tracker 
<https://bugs.python.org/issue37144>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37144] tarfile.open: improper handling of path-like object

2019-06-04 Thread Demid


Change by Demid :


--
nosy: +zygocephalus -dm

___
Python tracker 
<https://bugs.python.org/issue37144>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-06-04 Thread Demid


Change by Demid :


--
keywords: +patch
pull_requests: +13690
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/13805

___
Python tracker 
<https://bugs.python.org/issue37150>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-06-04 Thread Demid


New submission from Demid :

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 
<https://bugs.python.org/issue37150>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com