[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: > I'd imagine that bug is reproducible with `Path('C:\\Temp', 'C:')` > already, right? If that's the case, should it logged as a > separate issue? Yes, it's a separate issue that affects the _from_parts() call in absolute(). How about designing absolute() to

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Barney Gale
Barney Gale added the comment: @eryksun thanks for flagging, a couple thoughts: I'd imagine that bug is reproducible with `Path('C:\\Temp', 'C:')` already, right? If that's the case, should it logged as a separate issue? I'm planning to /experimentally/ throw away pathlib's internal path

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: > I'm not seeing what's wrong with your example. "C:" or "C:spam\\eggs" are not absolute paths. They depend on the effective working directory on the drive. An absolute path should never depend on a working directory, which can change at random. WinAPI

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg412220 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: > I'm not seeing what's wrong with your example. "C:" or "C:spam\\eggs" are not absolute paths. They depend on the effective working directory on the drive. An absolute path should never depend on a working directory, which can change at random. WinAPI

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Brett Cannon
Brett Cannon added the comment: @eryksun I'm not seeing what's wrong with your example. Would you mind pointing out what you expect the result to be? And are you saying on Windows you have to resolve the drive separately from the working directory and then concatenate them? --

[issue29688] Add support for Path.absolute()

2022-01-29 Thread Eryk Sun
Eryk Sun added the comment: In Windows, paths that are relative to the current directory on a drive aren't resolved. The following should be resolved by the current code: >>> os.chdir('C:/Temp') >>> pathlib.Path('C:').absolute() WindowsPath('C:') But _from_parts() has bugs with

[issue29688] Add support for Path.absolute()

2022-01-29 Thread Barney Gale
Barney Gale added the comment: Now that GH 26153 is merged, I think this bug can be resolved. -- ___ Python tracker ___ ___

[issue29688] Add support for Path.absolute()

2022-01-28 Thread Brett Cannon
Brett Cannon added the comment: New changeset 18cb2ef46c9998480f7182048435bc58265c88f2 by Barney Gale in branch 'main': bpo-29688: document and test `pathlib.Path.absolute()` (GH-26153) https://github.com/python/cpython/commit/18cb2ef46c9998480f7182048435bc58265c88f2 --

[issue29688] Add support for Path.absolute()

2021-06-12 Thread Barney Gale
Barney Gale added the comment: Hi - please could a core dev review PR 26153? It adds documentation and tests for Path.absolute(). Thank you! -- ___ Python tracker ___

[issue29688] Add support for Path.absolute()

2021-05-15 Thread Barney Gale
Barney Gale added the comment: New PR up here: https://github.com/python/cpython/pull/26153 The correspondence between `pathlib` and `os.path` is as follows: - `Path.resolve()` is roughly `os.path.realpath()` - `Path.absolute()` is roughly `os.path.abspath()` Differences: - `resolve()`

[issue29688] Add support for Path.absolute()

2021-05-15 Thread Barney Gale
Change by Barney Gale : -- keywords: +patch nosy: +barneygale nosy_count: 8.0 -> 9.0 pull_requests: +24787 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26153 ___ Python tracker

[issue29688] Add support for Path.absolute()

2021-03-17 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg289517 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue29688] Add support for Path.absolute()

2021-03-12 Thread Eryk Sun
Change by Eryk Sun : -- assignee: -> docs@python components: +Library (Lib) type: -> enhancement versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 3.7 ___ Python tracker

[issue29688] Add support for Path.absolute()

2020-10-19 Thread 4-launchpad-kalvdans-no-ip-org
Change by 4-launchpad-kalvdans-no-ip-org : -- nosy: +4-launchpad-kalvdans-no-ip-org ___ Python tracker ___ ___ Python-bugs-list

[issue29688] Add support for Path.absolute()

2019-12-18 Thread Brett Cannon
Brett Cannon added the comment: I have opened https://bugs.python.org/issue39090 to track updating the pathlib docs to have a section on getting the absolute path in various ways along with what the trade-offs are for each approach. -- ___ Python

[issue29688] Add support for Path.absolute()

2017-03-13 Thread Brett Cannon
Changes by Brett Cannon : -- assignee: brett.cannon -> ___ Python tracker ___ ___

[issue29688] Add support for Path.absolute()

2017-03-12 Thread INADA Naoki
INADA Naoki added the comment: > posixpath.abspath() collapses "//.." to "", this is not > correct. Not sure about ntpath.abspath(). I feel this is reasonable limitation, and expected behavior for some cases. So I think adding note about this in document is enough. -- nosy:

[issue29688] Add support for Path.absolute()

2017-03-12 Thread Eryk Sun
Eryk Sun added the comment: It's the same with ntpath.abspath since the underlying GetFullPathName function processes the path only as a string. OK, so it seems we're requiring that p.absolute().resolve() is the same as p.resolve(). Consider the following example: >>> p =

[issue29688] Add support for Path.absolute()

2017-03-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: posixpath.abspath() collapses "//.." to "", this is not correct. Not sure about ntpath.abspath(). -- nosy: +serhiy.storchaka ___ Python tracker

[issue29688] Add support for Path.absolute()

2017-03-12 Thread Brett Cannon
Brett Cannon added the comment: "What's the rationale for not calling self._flavour.pathmod.abspath() to implement absolute()?" Beats me. :) It's just how Antoine wrote it and that's all I know. -- ___ Python tracker

[issue29688] Add support for Path.absolute()

2017-03-11 Thread Eryk Sun
Eryk Sun added the comment: What's the rationale for not calling self._flavour.pathmod.abspath() to implement absolute()? For example: >>> p = pathlib.Path('C:/con') >>> p._flavour.pathmod.abspath(p) '.\\con' >>> p._from_parts((p._flavour.pathmod.abspath(p),), init=False)

[issue29688] Add support for Path.absolute()

2017-03-11 Thread Brett Cannon
Changes by Brett Cannon : -- title: Add support for Path.absolute -> Add support for Path.absolute() ___ Python tracker ___

[issue29688] Add support for Path.absolute

2017-03-11 Thread Brett Cannon
Changes by Brett Cannon : -- title: Document Path.absolute -> Add support for Path.absolute ___ Python tracker ___