[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2020-07-17 Thread Christoph Anton Mitterer


Change by Christoph Anton Mitterer :


--
nosy: +calestyo

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2019-05-31 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

The pull request attached to this issue has been closed as the repository was 
marked as unknown.  

This issue is now available for a new pull request.

--
nosy: +cheryl.sabella
stage:  -> needs patch
versions: +Python 3.9

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If tempfile doesn't have special code for supporting path-like objects, and 
nothing in the documentation points that path-like objects don't work, then the 
documentation doesn't need changes. This is just a consequence of implementing 
PEP 519 in low-level functions.

If tempfile._infer_return_type will treat *all* path-like objects as str, this 
is a bug.

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-08 Thread Brett Cannon

Brett Cannon added the comment:

The key thing with the docs is that it doesn't say anywhere "takes a string 
path" or a "path as a string" or something else that suggests path-like objects 
don't work. If you want to clearly state that path-like objects are acceptable 
that is fine as well.

As for the bytes/str parts, path-like objects that return bytes should work, 
but only if everything is str or bytes as passed into the function (e.g. mixing 
the types should not be expected to work).

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-08 Thread Louie Lu

Louie Lu added the comment:

Serhiy, though this no need to add versionchanged, should this need to explicit 
note in doc, that tempfile support os.PathLike?

also, I didn't get "add also tests for path-like objects returning bytes path", 
if `tempfile.mkdtemp(dir=pathlike.Path(''), pre=b'', suf=b'')` will raise 
TypeError, then we don't need to deal with path-like objects returning bytes. 
because tempfile._infer_return_type will treat path-like objects as str.

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't see any changes in tempfile.py. If the path-like protocol already is 
supported for the dir argument, no change in the documentation is needed.

tempfile.mkdtemp(dir=pathlike.Path(''), pre=b'', suf=b'') should raise a 
TypeError, but add also tests for path-like objects returning bytes path.

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-07 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1599

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-07 Thread Louie Lu

Louie Lu added the comment:

@Brett, do you think if given a path-like dir, it should only be treated as 
`str`, or it could be `str` and `bytes`?

My PR is now treated path-like dir as `str`, not `bytes`.

This will affect at this places:

tempfile.mkdtemp(dir=pathlike.Path(''), pre=b'', suf=b'')

Should it raise a TypeError (since we can't mix str and bytes), or it will 
convert path-like to bytes.

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-07 Thread Louie Lu

Louie Lu added the comment:

Regards my words, some place need to changed to support PathLike, I'll test it 
tomorrow.

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-07 Thread Louie Lu

Louie Lu added the comment:

Since tempfile is relay on `os`,

e.g. `file = _os.join.path(dir, pre+name+suf)`, 


it can directly accept dir as PathLike type, this should need to add test case 
for it.

--
nosy: +louielu

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2017-05-03 Thread Brett Cannon

Changes by Brett Cannon :


--
title: Add os.PathLike support to the tempfile module's 'dir' arguments -> 
Add/check os.PathLike support for the tempfile module's 'dir' arguments

___
Python tracker 

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