Title: pathlib.resolve(strict=False) only includes first child
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: mshuffett, pitrou, richardc, seirl, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-04-26 16:19 by mshuffett, last changed 2017-05-28 13:37 by richardc.

Pull Requests
URL Status Linked Edit
PR 1649 open Dormouse759, 2017-05-18 12:25
Messages (3)
msg292369 - (view) Author: Michael Shuffett (mshuffett) Date: 2017-04-26 16:19
According to the documentation
If strict is False, the path is resolved as far as possible and any remainder is appended without checking whether it exists.

The current behavior is not consistent with this, and only appends the first remainder.

For example:
If we have an empty '/tmp' directory
Path('/tmp/foo').resolve() and Path('/tmp/foo/bar').resolve() both result in Path('/tmp/foo') but Path('/tmp/foo/bar').resolve() should result in Path('/tmp/foo/bar')
msg292623 - (view) Author: Antoine Pietri (seirl) * Date: 2017-04-30 10:12
I can reproduce this bug. This behavior is really confusing.
msg294647 - (view) Author: Richard Cooper (richardc) Date: 2017-05-28 13:37
Pull Request (PR 1649) treats this as a documentation problem. I would argue that the documentation is correct and this is a bug in the code.

The `strict` flag was added as a result of issue19717. The decision on what to do when strict=False seems to come in where Guido says:

"I would prefer it if Path.resolve() resolved symlinks until it hits
something that doesn't exist and then just keep the rest of the path

The documented behaviour also seems much more useful than the current behaviour.
Date User Action Args
2017-05-28 13:37:40richardcsetnosy: + richardc
messages: + msg294647
2017-05-18 12:25:13Dormouse759setpull_requests: + pull_request1744
2017-04-30 10:12:58seirlsetnosy: + seirl
messages: + msg292623
2017-04-26 17:18:12serhiy.storchakasetnosy: + pitrou, serhiy.storchaka
2017-04-26 16:19:45mshuffettcreate