]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Correction to 88e318166eaf - Issue #11583
authorBrian Curtin <brian@python.org>
Thu, 9 Jun 2011 14:10:38 +0000 (09:10 -0500)
committerBrian Curtin <brian@python.org>
Thu, 9 Jun 2011 14:10:38 +0000 (09:10 -0500)
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.

Lib/ntpath.py
Modules/posixmodule.c

index 2483ced7fff5019fbf5e33d2a1d8bc741e8cd4bc..826be87d3c7c5e296dc9ace5f43e1b3daa47875a 100644 (file)
@@ -679,9 +679,7 @@ try:
     # attribute to tell whether or not the path is a directory.
     # This is overkill on Windows - just pass the path to GetFileAttributes
     # and check the attribute from there.
-    from nt import _isdir
+    from nt import _isdir as isdir
 except ImportError:
-    from genericpath import isdir as _isdir
-
-def isdir(path):
-    return _isdir(path)
+    # Use genericpath.isdir as imported above.
+    pass
index 767ed612903af84fe9e1a0c247403354a2a060ff..eb2e412ebcfc4828bb3b874b9f4a21ea4f439c3d 100644 (file)
@@ -2820,6 +2820,9 @@ posix__getfileinformation(PyObject *self, PyObject *args)
                                 info.nFileIndexLow);
 }
 
+PyDoc_STRVAR(posix__isdir__doc__,
+"Return true if the pathname refers to an existing directory.");
+
 static PyObject *
 posix__isdir(PyObject *self, PyObject *args)
 {
@@ -8091,7 +8094,7 @@ static PyMethodDef posix_methods[] = {
     {"_getfullpathname",        posix__getfullpathname, METH_VARARGS, NULL},
     {"_getfinalpathname",       posix__getfinalpathname, METH_VARARGS, NULL},
     {"_getfileinformation",     posix__getfileinformation, METH_VARARGS, NULL},
-    {"_isdir",                  posix__isdir, METH_VARARGS, NULL},
+    {"_isdir",                  posix__isdir, METH_VARARGS, posix__isdir__doc__},
 #endif
 #ifdef HAVE_GETLOADAVG
     {"getloadavg",      posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},