Skip to content

Commit

Permalink
pythongh-109782: Ensure os.path.isdir has the same signature on all…
Browse files Browse the repository at this point in the history
… platforms (pythonGH-109790)
  • Loading branch information
aminalaee authored Sep 28, 2023
1 parent 3814bc1 commit 7df8b16
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ensure the signature of :func:`os.path.isdir` is identical on all platforms.
Patch by Amin Alaee.
16 changes: 8 additions & 8 deletions Modules/clinic/posixmodule.c.h

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

10 changes: 5 additions & 5 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4912,25 +4912,25 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
/*[clinic input]
os._path_isdir
path: 'O'
s: 'O'
Return true if the pathname refers to an existing directory.
[clinic start generated code]*/

static PyObject *
os__path_isdir_impl(PyObject *module, PyObject *path)
/*[clinic end generated code: output=00faea0af309669d input=b1d2571cf7291aaf]*/
os__path_isdir_impl(PyObject *module, PyObject *s)
/*[clinic end generated code: output=9d87ab3c8b8a4e61 input=c17f7ef21d22d64e]*/
{
HANDLE hfile;
BOOL close_file = TRUE;
FILE_BASIC_INFO info;
path_t _path = PATH_T_INITIALIZE("isdir", "path", 0, 1);
path_t _path = PATH_T_INITIALIZE("isdir", "s", 0, 1);
int result;
BOOL slow_path = TRUE;
FILE_STAT_BASIC_INFORMATION statInfo;

if (!path_converter(path, &_path)) {
if (!path_converter(s, &_path)) {
path_cleanup(&_path);
if (PyErr_ExceptionMatches(PyExc_ValueError)) {
PyErr_Clear();
Expand Down

0 comments on commit 7df8b16

Please sign in to comment.