changeset: 70738:fe813f5711a5 branch: 2.7 parent: 70734:7164bdfa0b0b user: Brian Curtin date: Thu Jun 09 10:00:42 2011 -0500 files: Lib/ntpath.py Modules/posixmodule.c description: 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. diff -r 7164bdfa0b0b -r fe813f5711a5 Lib/ntpath.py --- a/Lib/ntpath.py Thu Jun 09 14:26:10 2011 +0200 +++ b/Lib/ntpath.py Thu Jun 09 10:00:42 2011 -0500 @@ -527,9 +527,7 @@ # 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 diff -r 7164bdfa0b0b -r fe813f5711a5 Modules/posixmodule.c --- a/Modules/posixmodule.c Thu Jun 09 14:26:10 2011 +0200 +++ b/Modules/posixmodule.c Thu Jun 09 10:00:42 2011 -0500 @@ -4200,6 +4200,9 @@ 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 @@ {"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__},