mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Correction to f1509fc75435 - Issue #11583
Rather than wrapping the C _isdir function in a Python function, just import the C _isdir function directly. Additionally, add in the docstring which was left out.
This commit is contained in:
parent
5cf8660f0b
commit
5446f08c60
2 changed files with 7 additions and 6 deletions
|
|
@ -527,9 +527,7 @@ try:
|
||||||
# attribute to tell whether or not the path is a directory.
|
# attribute to tell whether or not the path is a directory.
|
||||||
# This is overkill on Windows - just pass the path to GetFileAttributes
|
# This is overkill on Windows - just pass the path to GetFileAttributes
|
||||||
# and check the attribute from there.
|
# and check the attribute from there.
|
||||||
from nt import _isdir
|
from nt import _isdir as isdir
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from genericpath import isdir as _isdir
|
# Use genericpath.isdir as imported above.
|
||||||
|
pass
|
||||||
def isdir(path):
|
|
||||||
return _isdir(path)
|
|
||||||
|
|
|
||||||
|
|
@ -4200,6 +4200,9 @@ win32_kill(PyObject *self, PyObject *args)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(posix__isdir__doc__,
|
||||||
|
"Return true if the pathname refers to an existing directory.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix__isdir(PyObject *self, PyObject *args)
|
posix__isdir(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
|
@ -9003,7 +9006,7 @@ static PyMethodDef posix_methods[] = {
|
||||||
{"abort", posix_abort, METH_NOARGS, posix_abort__doc__},
|
{"abort", posix_abort, METH_NOARGS, posix_abort__doc__},
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
{"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL},
|
{"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL},
|
||||||
{"_isdir", posix__isdir, METH_VARARGS, NULL},
|
{"_isdir", posix__isdir, METH_VARARGS, posix__isdir__doc__},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GETLOADAVG
|
#ifdef HAVE_GETLOADAVG
|
||||||
{"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
|
{"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue