-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-102511: Add C implementation of os.path.splitroot()
#118089
Conversation
ntpath.splitroot()
os.path.splitroot()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great looking change! As Erlend pointed out, a couple of robustness things to check, and there's a potential behaviour change that's worth validating and describing in Doc\whatsnew\3.13.rst
and possibly in other parts of the documentation.
Misc/NEWS.d/next/Core and Builtins/2024-04-19-08-50-48.gh-issue-102511.qDEB66.rst
Outdated
Show resolved
Hide resolved
…e-102511.qDEB66.rst Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Oh, come on, why must argclinic raise an error here? That isn't useful:
|
Oh right, I forgot about this behaviour of argument clinic 😞 Might be a good reason to go to Alternatively, you could handle the |
My implementation returned a pointer to the |
It might just be my laptop or because I'm comparing with 3.12. (there doesn't seem to be a way to have 2 builds at the same time) |
OK, how's the build going? |
You can use worktrees. Anyway, I still have my implementation, but there's no need to delve further into the comparison because the reason is obvious. I was testing the builtin function directly, not a wrapper function that called
It's 1.76 times faster without the wrapper. |
Could you explain how I can use them?
Yeah, that matches the performance when I used I tried to work around the first issue by modifying |
Here's a brief overview of worktrees in the developer's guide: https://devguide.python.org/getting-started/git-boot-camp/#git-worktree
In another issue, the implementation of |
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Let's leave |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks, nineteendo.
That's quorum, thanks @nineteendo for bearing with us, and congrats on landing the patch! |
|
Hmm, it didn't fail in the previous commit: https://buildbot.python.org/all/#/builders/1380/builds/86 |
This seems unrelated, and if it's only iOS, then we can ignore it. That buildbot has only just started running, and will be flushing out random issues for a little while. |
Eryk, can we backport this to 3.12 to fix the bug with |
GH-119394 is a backport of this pull request to the 3.12 branch. |
Please add a unittest coverage of both the Python and C versions so that we ensure their behavior is the same. |
@gpshead, they both get tested as long as tests run on at least one POSIX system and one Windows system. The Python fallback implementation is only defined if the C version can't be imported. Thus the fallback for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR also changes first parameter name. It is now:
p
for python versionpath
for C version
Is this intentional? Does it need addressing before 3.13.0 in two weeks? |
I would prefer to address this, because:
|
I will open a PR in a moment. |
Benchmark
ntpath.py