-
-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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-102038: Skip a sometimes unnecessary stat in site.py #102039
Conversation
@@ -0,0 +1 @@ | |||
Skip a ``stat`` in :mod:`site` if we have already found a ``pyvenv.cfg`` |
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.
With stat
you mean the os.path.isfile
check that is skipped? I am unfamiliar with the term, but from the news entry alone I did not understand this.
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.
Yeah, an unnecessary os.path.isfile is skipped. "stat" here comes from the name of the syscall: https://en.wikipedia.org/wiki/Stat_(system_call)
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.
Looks good to me.
I also changed the
exe_dir
assignment to useos.path.dirname
. This is exactly equivalent toos.path.split(...)[0]
; the only reason we usedsplit
was refactoring in 27e4b60