[issue41357] pathlib.Path.resolve incorrect os.path equivalent

2020-07-22 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


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

___
Python tracker 

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



[issue41357] pathlib.Path.resolve incorrect os.path equivalent

2020-07-22 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

I uploaded a script illustrating the differences between how Path.resolve(), 
os.path.abspath(), and os.path.realpath() handle symlinks.  As noted by 
Jendrik, Path.resolve() and os.path.realpath() both resolve symlinks, while 
os.path.abspath() does not.  The documentation needs to be updated.  I will 
generate a pull request.

Example run on the master branch:

python version:
3.9.0a0 (heads/master-dirty:f69d5c6198, Jul 16 2019, 12:38:41) 
[Clang 10.0.1 (clang-1001.0.46.4)]

tdir1: /var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo1
creating tdir1
tdir2: /var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo2
creating tdir2 as symlink to tdir1
Path(tdir1).resolve(): 
/private/var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo1
Path(tdir2).resolve(): 
/private/var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo1
os.path.abspath(tdir1): 
/var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo1
os.path.abspath(tdir2): 
/var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo2
os.path.realpath(tdir1): 
/private/var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo1
os.path.realpath(tdir2): 
/private/var/folders/w7/mxt827716xs7_3wbk3mqwd3hgn/T/tmpyj7juuca/foo1

--
Added file: https://bugs.python.org/file49333/bpo-41537-test.py

___
Python tracker 

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



[issue41357] pathlib.Path.resolve incorrect os.path equivalent

2020-07-22 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue41357] pathlib.Path.resolve incorrect os.path equivalent

2020-07-21 Thread Jendrik Weise


New submission from Jendrik Weise :

According to the table at the bottom of the pathlib documentation 
Path.resolve() is equivalent to os.path.abspath(path). In contrast to the 
latter Path.resolve() does follow symlinks though, making it more similar to 
os.path.realpath(path).

--
assignee: docs@python
components: Documentation
messages: 374060
nosy: Jendrik Weise, docs@python
priority: normal
severity: normal
status: open
title: pathlib.Path.resolve incorrect os.path equivalent
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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