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

[3.13] gh-124917: Allow keyword args to os.path.exists/lexists on Windows (GH-124918) by JelleZijlstra · Pull Request #125332 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .h  (1) .py  (1) .rst  (1) All 4 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 4 additions & 0 deletions Lib/test/test_genericpath.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def test_exists(self):
self.assertIs(self.pathmodule.lexists(filename + '\x00'), False)
self.assertIs(self.pathmodule.lexists(bfilename + b'\x00'), False)

# Keyword arguments are accepted
self.assertIs(self.pathmodule.exists(path=filename), True)
self.assertIs(self.pathmodule.lexists(path=filename), True)

@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
@unittest.skipIf(is_emscripten, "Emscripten pipe fds have no stat")
def test_exists_fd(self):
Expand Down
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allow calling :func:`os.path.exists` and :func:`os.path.lexists` with
keyword arguments on Windows. Fixes a regression in 3.13.0.
78 changes: 69 additions & 9 deletions Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions Modules/posixmodule.c
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
Original file line number Diff line number Diff line change
Expand Up @@ -5391,15 +5391,14 @@ _testFileType(path_t *path, int testedType)
os._path_exists -> bool

path: path_t(allow_fd=True, suppress_value_error=True)
/

Test whether a path exists. Returns False for broken symbolic links.

[clinic start generated code]*/

static int
os__path_exists_impl(PyObject *module, path_t *path)
/*[clinic end generated code: output=8da13acf666e16ba input=29198507a6082a57]*/
/*[clinic end generated code: output=8da13acf666e16ba input=142beabfc66783eb]*/
{
return _testFileExists(path, TRUE);
}
Expand All @@ -5409,15 +5408,14 @@ os__path_exists_impl(PyObject *module, path_t *path)
os._path_lexists -> bool

path: path_t(allow_fd=True, suppress_value_error=True)
/

Test whether a path exists. Returns True for broken symbolic links.

[clinic start generated code]*/

static int
os__path_lexists_impl(PyObject *module, path_t *path)
/*[clinic end generated code: output=e7240ed5fc45bff3 input=03d9fed8bc6ce96f]*/
/*[clinic end generated code: output=e7240ed5fc45bff3 input=208205112a3cc1ed]*/
{
return _testFileExists(path, FALSE);
}
Expand Down

Back | FazBrowse Home | New Git URL