[issue27182] PEP 519 support in the stdlib

2020-11-06 Thread Brett Cannon


Change by Brett Cannon :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3417d324cbf9 by Brett Cannon in branch 'default':
Issue #27182: Add support for path-like objects to PyUnicode_FSDecoder().
https://hg.python.org/cpython/rev/3417d324cbf9

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-08-26 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee: brett.cannon -> 

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-08-26 Thread Brett Cannon

Brett Cannon added the comment:

The os and os.path modules are now done! The means PEP 519 is finished. At this 
point individual modules will need to be checked to see if they do (not) 
support os.PathLike.

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

Here is an odd patch because I don't know where else to put it ATM that adds 
the remaining support in the os module/package not covered by other issues w/ 
patches (specifically os.walk() and os.fwalk()). I think everything else simply 
falls through thanks to os.path and path_converter.

--
Added file: http://bugs.python.org/file44091/os.diff

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-08-05 Thread Brett Cannon

Brett Cannon added the comment:

Just a quick update: between the patches for issue #26027 and issue #26667, the 
necessary code to make os.path work with path-like objects is done. At this 
point I'm just waiting for code reviews on those patches.

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-24 Thread Brett Cannon

Changes by Brett Cannon :


--
dependencies:  -Add a "What's New" entry for PEP 519

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-09 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
dependencies: +Add a "What's New" entry for PEP 519

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6239673d5e1d by Brett Cannon in branch 'default':
Issue #27182: Document os.PathLike.
https://hg.python.org/cpython/rev/6239673d5e1d

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-05 Thread Brett Cannon

Brett Cannon added the comment:

Functions that only accept file descriptors should not be updated to work with 
__fspath__() as it will never return an int/fd.

As for Ethan's suggestion, are you saying you want to toss the str/bytes check 
from os.fspath()? If so then you will need to go to python-dev and bring that 
up as the PEP clearly specifies that str/bytes is checked for and specifically 
in the order of the Python code. The thinking behind the current design is that 
since __fspath__() has to be explicitly implemented that people will do so 
properly, versus accidentally passing in some type that isn't str/bytes like 
the pre-PEP 519 world (i.e. trust the __fspath__() implementors to do the right 
thing and only protect against someone passing in something wrong from 
complicated code flow).

There has been discussion about using the ``path.__fspath__() if hasattr(path, 
'__fspath__') else path`` idiom in os.path so that the pre-existing type-checks 
can do their thing instead of checking twice, although that's different from 
how os.fspath() works (then again, since this is all new code we could argue 
that going our own route in os.path is acceptable in the name of performance).

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-04 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

If we do that, then os.* functions that accept fds would also work on objects 
whose __fspath__ method returns an integer. I don't think that is desirable (I 
was just writing a test to ensure that fspath returning an integer throws an 
error).

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-04 Thread Ethan Furman

Ethan Furman added the comment:

Currently, os.fspath will raise an exception if the thing passed in is not 
str/bytes/PathLike, and that error message will proclaim that str or bytes or 
PathLike is required; however, this is not true in cases such as Path (which 
doesn't allow bytes), and incomplete in cases such as os.open (which also 
allows ints).

On the other hand, if the thing has a functional __fspath__ (meaning calling it 
doesn't raise an exception) then os.fspath will return whatever that method 
returns, which could be complete garbage.

So os.fspath is being too strict, too open, and too lax all at the same time.

Given Guido's reluctance to check the output of __fspath__(), plus the current 
difficulty of painless integration with existing functions, I think we should 
have os.fspath() only raise an exception if obj.__fspath__ exists and calling 
it raises an exception, otherwise we return the result of calling 
obj.__fspath__(), or obj if it doesn't have __fspath__.

In case that wasn't clear, attached is a unit test that passes when the above 
changes are implemented.

--
Added file: http://bugs.python.org/file43213/test_fspath.py

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-04 Thread Ethan Furman

Changes by Ethan Furman :


--
Removed message: http://bugs.python.org/msg267280

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-04 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

Attached patch fixes the undefined variable and adds additional tests.

--
Added file: http://bugs.python.org/file43201/issue27182-path_type.patch

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-04 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

In the patch that was just committed, the path_type variables are undefined 
(os.py lines 892 and 908). There is also no test for these error cases—we 
should test the cases where the path has no __fspath__ or does not return a 
bytes or str.

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 00991aa5fdb5 by Ethan Furman in branch 'default':
issue27182: update fsencode and fsdecode for os.path(); patch by Dusty Phillips
https://hg.python.org/cpython/rev/00991aa5fdb5

--
nosy: +python-dev

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-03 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

This patch makes the Python and C versions of open()/io.open() support the 
fspath protocol.

--
keywords: +patch
Added file: http://bugs.python.org/file43156/issue27182-open.patch

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-03 Thread Ethan Furman

Ethan Furman added the comment:

Sorry, Serhiy, I had my module names mixed up.

`nt` and `posix` are the same, but `ntpath` and `posixpath` are not (I may have 
those first two names wrong again, but hopefully you get the idea).

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-03 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

FYI, I'm working on a patch for builtins.open to call PyOS_FSPath.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Ethan Furman added the comment:

Nope.

There is a posixpath.py and an ntpath.py, and they are not the same.

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Isn't the nt module just an alias of the posix module?

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Ethan Furman added the comment:

os.fspath(): issue27186

--
dependencies: +add os.fspath()

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Changes by Ethan Furman :


--
dependencies: +Support Path objects in the posix module, Support path objects 
in the nt module, Update importlib to accept pathlib.Path objects
type:  -> behavior
versions: +Python 3.6

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Changes by Ethan Furman :


--
type: behavior -> enhancement

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Ethan Furman added the comment:

nt module: issue27184

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Ethan Furman added the comment:

importlib: issue26667

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

Ethan Furman added the comment:

posix module: issue26027

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-02 Thread Ethan Furman

New submission from Ethan Furman:

Meta issue to track adding PEP 519 support in the various stdlib modules.

--
messages: 266891
nosy: brett.cannon, ethan.furman, serhiy.storchaka
priority: normal
severity: normal
status: open
title: PEP 519 support in the stdlib

___
Python tracker 

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