GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths by barneygale · Pull Request #113829 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented Jan 8, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

On Windows, os.path.isabs() now returns False when given a path that starts with exactly one (back)slash. This is more compatible with other functions in os.path, and with Microsoft's own documentation.

Also adjust pathlib.PureWindowsPath.is_absolute() to call ntpath.isabs(), which corrects its handling of partial UNC/device paths like //foo.

  • Issue: Add os.path.isrelative() and improve ntpath.isabs() #44626
  • Issue: pathlib.PureWindowsPath.is_absolute() can return False for UNC paths #105476

📚 Documentation preview 📚: https://cpython-previews--113829.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@barneygale @jonfoster
pythonGH-44626, pythonGH-105476: Fix ntpath.isabs() handling of par…
2100e3e
…t-absolute paths.

On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <[email protected]>
@barneygale barneygale added type-bug An unexpected behavior, bug, or error topic-pathlib labels Jan 8, 2024
@barneygale
barneygale requested a review from zooba January 8, 2024 21:31
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 8, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 8, 2024
Add os.path.isrelative() and improve ntpath.isabs() #44626
Open
@barneygale
Attempt to fix some test failures.
f6f0e35
zooba
zooba approved these changes Jan 8, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jan 8, 2024
@barneygale
Fix tests, attempt python#2
bb7abe5
@barneygale

barneygale commented Jan 13, 2024

Copy link
Copy Markdown
Contributor Author

Thank you for the review @zooba!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale
barneygale merged commit e4ff131 into python:main Jan 13, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Jan 13, 2024
@barneygale barneygale mentioned this pull request Jan 13, 2024
pathlib.PureWindowsPath.is_absolute() can return False for UNC paths #105476
Closed
@finnagin finnagin mentioned this pull request Jan 17, 2024
Wrong paths from nt._getfinalpathname with DOS device selectors in the CWD #112563
Open
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
@barneygale @jonfoster @kulikjak
pythonGH-44626, pythonGH-105476: Fix ntpath.isabs() handling of par…
7fbe155
…t-absolute paths (python#113829)

On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <[email protected]>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@barneygale @jonfoster @aisk
pythonGH-44626, pythonGH-105476: Fix ntpath.isabs() handling of par…
d1160d6
…t-absolute paths (python#113829)

On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <[email protected]>
@mwichmann mwichmann mentioned this pull request Mar 22, 2024
Python 3.13 alpha breaks explain() SCons/scons#4504
Closed
@nineteendo nineteendo mentioned this pull request Mar 30, 2024
Fix error message for ntpath.commonpath #117381
Closed
@richfitz richfitz mentioned this pull request Apr 24, 2024
Add support for shared resources. mrc-ide/pyorderly#43
Merged
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@barneygale @jonfoster @Glyphack
pythonGH-44626, pythonGH-105476: Fix ntpath.isabs() handling of par…
29f3174
…t-absolute paths (python#113829)

On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <[email protected]>
@nineteendo nineteendo mentioned this pull request Oct 11, 2024
os.path.isabs change in behavior in Python 3.13 on MS-Windows #125283
Closed
@marc-hb marc-hb mentioned this pull request Oct 11, 2024
.github: Update supported python versions zephyrproject-rtos/west#752
Merged
@shoeffner shoeffner mentioned this pull request Oct 23, 2024
[bug] src\meson.build:1:0: ERROR: prefix value '/' must be an absolute path conan-io/conan#17204
Closed
@psobolewskiPhD psobolewskiPhD mentioned this pull request Jan 1, 2025
[py313] Update plugins/test_utils.py to account for Windows py313 os.path.isabs change napari/napari#7482
Merged
jni pushed a commit to napari/napari that referenced this pull request Jan 2, 2025
@psobolewskiPhD @pre-commit-ci
[py313] Update plugins/test_utils.py to account for Windows py313 os.…
386ebbf
…path.isabs change (#7482)

# References and relevant issues
Needed by: #7481

# Description
Python 3.13 changed how `os.path.isabs` works on Windows:
python/cpython#113829
Specifically, it will now return False for paths like `/foo/bar` on
Windows, while True on POSIX.
For True on Windows the path now needs to be `\\foo\bar`

We have 2 tests that use paths like `/foo/bar` and expect them to be
considered absolute.
In this PR, I add logic to test the proper paths on Windows using `\`.

You can see all tests pass on 3.13 with this fix in my fork:
https://github.com/psobolewskiPhD/napari/actions/runs/12574076907/job/35047736273

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
skshetry added a commit to treeverse/dvc that referenced this pull request Jan 10, 2025
@skshetry
3.13 support for Windows (#10667)
7d14acb
python/cpython#113829 changed `os.path.isabs` on Windows to not consider a path starting a single backslash to be an absolute path.

We do a lot of naive `posixpath` to `ntpath` conversions, and it broke DVC in multiple places. DVC is likely broken in many other places, and these bugs are difficult to identify.

In this commit, I have tried to fix in the places where the tests failed. And mostly by trying to imitate pre-3.13 behaviour.
Some of the changes may not be correct but keeps the old behaviour in place.

Also re-enabled the CI for all Python versions supported for Windows.
This was referenced Feb 27, 2025
Prefix option does not allow POSIX default values when cross-compiling on Windows with Python 3.13 mesonbuild/meson#14303
Closed
Prefix should follow the path scheme of the host machine mesonbuild/meson#7577
Closed
@joukewitteveen joukewitteveen mentioned this pull request Jul 23, 2025
Add suffix function to the fs module mesonbuild/meson#14802
Merged
@serhiy-storchaka serhiy-storchaka mentioned this pull request Aug 8, 2026
[ntpath] realpath fails for broken symlinks with rooted target paths #85035
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zooba zooba zooba approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-pathlib type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@barneygale @zooba
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.