FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-82367: Use `FindFirstFile` Win32 API in `ntpath.realpath()` by moonsikpark · Pull Request #110298 · python/cpython · GitHub

/ cpython Public

gh-82367: Use FindFirstFile Win32 API in ntpath.realpath() - #110298

Merged
zware merged 1 commit into
python:mainfrom
moonsikpark:gh-82367-use-findfirstfile-in-nt-realpath
Oct 5, 2023
Merged

gh-82367: Use FindFirstFile Win32 API in ntpath.realpath()#110298
zware merged 1 commit into
python:mainfrom
moonsikpark:gh-82367-use-findfirstfile-in-nt-realpath

Conversation

moonsikpark commented Oct 3, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

ntpath.realpath() breaks out of traversing a series of paths where a (handled) ERROR_ACCESS_DENIED or ERROR_SHARING_VIOLATION occurs.

Using FindFirstFile Win32 API, we can query their real name to correct the case and also resolve MS-DOS (also called 8.3) style file names such as C:\\LONGFI~1.TXT.


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

zware left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A few documentation nits, but mostly this looks pretty good to me. It will need approval from either @zooba or @eryksun before I'd be comfortable merging it, though.

Comment thread Doc/whatsnew/3.13.rst Outdated
Comment thread Doc/library/os.path.rst Outdated
zware requested review from eryksun and zooba October 3, 2023 17:28

zooba commented Oct 3, 2023

Copy link
Copy Markdown
Member

The code change looks great to me. Awesome job!

With Zach's requested doc changes, I think this is good to merge.

moonsikpark force-pushed the gh-82367-use-findfirstfile-in-nt-realpath branch from 2c49ffc to 4590347 Compare October 4, 2023 11:38
moonsikpark added a commit to moonsikpark/cpython that referenced this pull request Oct 4, 2023
…ython#110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
moonsikpark force-pushed the gh-82367-use-findfirstfile-in-nt-realpath branch from 4590347 to f675a4f Compare October 4, 2023 11:50

ghost commented Oct 4, 2023
edited by ghost
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

moonsikpark added a commit to moonsikpark/cpython that referenced this pull request Oct 4, 2023
…ython#110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
moonsikpark force-pushed the gh-82367-use-findfirstfile-in-nt-realpath branch from d88c757 to e17852c Compare October 4, 2023 14:41
Comment thread Lib/ntpath.py Outdated
Comment thread Lib/test/test_ntpath.py
Comment thread Lib/test/test_ntpath.py Outdated
Comment thread Lib/test/test_ntpath.py
Comment thread Lib/test/test_ntpath.py
Comment thread Lib/test/test_ntpath.py Outdated
Comment thread Lib/test/test_ntpath.py Outdated

eryksun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Thank you, Moonsik, and thanks also for taking the extra time to make the test more robust.

…ython#110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
moonsikpark force-pushed the gh-82367-use-findfirstfile-in-nt-realpath branch from 1766bc3 to 2b5a29e Compare October 5, 2023 08:38
zware merged commit d33aa18 into python:main Oct 5, 2023

zware commented Oct 5, 2023

Copy link
Copy Markdown
Member

Thanks Steve and Eryk for the reviews, and Moonsik for the patch and excellent collaboration!

moonsikpark deleted the gh-82367-use-findfirstfile-in-nt-realpath branch October 5, 2023 17:10
moonsikpark restored the gh-82367-use-findfirstfile-in-nt-realpath branch October 6, 2023 02:17
moonsikpark deleted the gh-82367-use-findfirstfile-in-nt-realpath branch October 6, 2023 02:20
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…ythonGH-110298)

* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
encukou added a commit to encukou/cpython that referenced this pull request Jun 3, 2025
The test was added in pythongh-110298, with a fix that was never backported
to 3.12 and below.
It was most likely skipped in the GHA run.
ambv pushed a commit that referenced this pull request Jun 3, 2025
The test was added in gh-110298, with a fix that was never backported
to 3.12 and below.
It was most likely skipped in the GHA run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL