Skip to content
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-75586: Fix case where PATHEXT isn't applied to items in PATH (Windows) #103179

Merged
merged 31 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
01c152e
GH-75586 - Fix case where PATHEXT isn't applied to items in PATH (Win…
csm10495 Apr 2, 2023
0d4cd7b
PR updates
csm10495 Apr 2, 2023
5fac84a
Add tests
csm10495 Apr 2, 2023
fa145da
PR updates
csm10495 Apr 2, 2023
84a7976
line len fix
csm10495 Apr 2, 2023
63a06c4
📜🤖 Added by blurb_it.
blurb-it[bot] Apr 2, 2023
7686a23
Add changelog entry
csm10495 Apr 2, 2023
381e4fe
Double backticks
csm10495 Apr 2, 2023
e7c0b58
Update Lib/shutil.py
csm10495 Apr 2, 2023
26e3b15
PR updates
csm10495 Apr 2, 2023
6272b62
pep8 fix
csm10495 Apr 2, 2023
b6d29c8
Update Lib/test/test_shutil.py
csm10495 Apr 2, 2023
1096cb7
Update Lib/test/test_shutil.py
csm10495 Apr 2, 2023
92955d0
Update Lib/shutil.py
csm10495 Apr 3, 2023
616df6c
docs updates
csm10495 Apr 3, 2023
255e4ff
Add another test
csm10495 Apr 3, 2023
f52868d
Update Doc/library/shutil.rst
csm10495 Apr 3, 2023
6e9269f
rewording
csm10495 Apr 3, 2023
a6b7eab
Rewording
csm10495 Apr 3, 2023
7480daa
Reword whats new
csm10495 Apr 3, 2023
a48260c
Clarify
csm10495 Apr 3, 2023
6bb6f6c
Clarify how to not search cwd for exes
csm10495 Apr 3, 2023
b5f3eba
Doc updates
csm10495 Apr 3, 2023
3bf4b8d
Update Doc/library/shutil.rst
csm10495 Apr 3, 2023
be73608
Update 2023-04-02-22-04-26.gh-issue-75586.526iJm.rst
csm10495 Apr 3, 2023
0169ba9
Update Doc/library/shutil.rst
csm10495 Apr 4, 2023
499d2de
Update Lib/shutil.py
csm10495 Apr 4, 2023
3ead780
Add test for behavior
csm10495 Apr 4, 2023
f9267da
kick ci
csm10495 Apr 4, 2023
d1e68ff
Mention cwd first behavior
csm10495 Apr 4, 2023
9badf8c
Wording
csm10495 Apr 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def _win_path_needs_curdir(cmd, mode):
if we should add the cwd to PATH when searching for executables if
the mode is executable.
"""
return (not (mode & os.X_OK) or
return (not (mode & os.X_OK)) or \
csm10495 marked this conversation as resolved.
Show resolved Hide resolved
_winapi.NeedCurrentDirectoryForExePath(
cmd if isinstance(cmd, str) else os.fsdecode(cmd))
csm10495 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
6 changes: 5 additions & 1 deletion Lib/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2210,9 +2210,13 @@ def test_win_path_needs_curdir(self):
self.assertTrue(shutil._win_path_needs_curdir('dontcare', os.X_OK))
need_curdir_mock.assert_called_once_with('dontcare')
need_curdir_mock.reset_mock()
self.assertFalse(shutil._win_path_needs_curdir('dontcare', 0))
self.assertTrue(shutil._win_path_needs_curdir('dontcare', 0))
need_curdir_mock.assert_not_called()

with unittest.mock.patch('shutil._winapi.NeedCurrentDirectoryForExePath', return_value=False) as need_curdir_mock:
csm10495 marked this conversation as resolved.
Show resolved Hide resolved
self.assertFalse(shutil._win_path_needs_curdir('dontcare', os.X_OK))
need_curdir_mock.assert_called_once_with('dontcare')


class TestWhichBytes(TestWhich):
def setUp(self):
Expand Down