Commit 95d028fd authored by Brian Curtin's avatar Brian Curtin

Correction to 88e318166eaf - 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.
parent ebc991c0
...@@ -679,9 +679,7 @@ try: ...@@ -679,9 +679,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)
...@@ -2820,6 +2820,9 @@ posix__getfileinformation(PyObject *self, PyObject *args) ...@@ -2820,6 +2820,9 @@ posix__getfileinformation(PyObject *self, PyObject *args)
info.nFileIndexLow); info.nFileIndexLow);
} }
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)
{ {
...@@ -8091,7 +8094,7 @@ static PyMethodDef posix_methods[] = { ...@@ -8091,7 +8094,7 @@ static PyMethodDef posix_methods[] = {
{"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL}, {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL},
{"_getfinalpathname", posix__getfinalpathname, METH_VARARGS, NULL}, {"_getfinalpathname", posix__getfinalpathname, METH_VARARGS, NULL},
{"_getfileinformation", posix__getfileinformation, METH_VARARGS, NULL}, {"_getfileinformation", posix__getfileinformation, 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__},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment