]> granicus.if.org Git - python/commitdiff
Correction to f1509fc75435 - Issue #11583
authorBrian Curtin <brian@python.org>
Thu, 9 Jun 2011 15:00:42 +0000 (10:00 -0500)
committerBrian Curtin <brian@python.org>
Thu, 9 Jun 2011 15:00:42 +0000 (10:00 -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 e121262199aa8a6f9614dfcc05c208aeaeae1054..4f8f423c0839e9b7524c72b9c67f5a01a681a647 100644 (file)
@@ -527,9 +527,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 e5fdc5a46371c79c36fad95e7346556b1eac5e9b..2431e1cb5fa36c583367d6b888c9bf70f40c59e6 100644 (file)
@@ -4200,6 +4200,9 @@ win32_kill(PyObject *self, PyObject *args)
     return result;
 }
 
+PyDoc_STRVAR(posix__isdir__doc__,
+"Return true if the pathname refers to an existing directory.");
+
 static PyObject *
 posix__isdir(PyObject *self, PyObject *args)
 {
@@ -9003,7 +9006,7 @@ static PyMethodDef posix_methods[] = {
     {"abort",           posix_abort, METH_NOARGS, posix_abort__doc__},
 #ifdef MS_WINDOWS
     {"_getfullpathname",        posix__getfullpathname, 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__},