diff -r e8f40d4f497c Lib/ntpath.py --- a/Lib/ntpath.py Tue Jan 22 10:32:16 2013 +0200 +++ b/Lib/ntpath.py Tue Jan 22 14:27:53 2013 +0200 @@ -636,23 +636,6 @@ return join(*rel_list) -# determine if two files are in fact the same file -try: - # GetFinalPathNameByHandle is available starting with Windows 6.0. - # Windows XP and non-Windows OS'es will mock _getfinalpathname. - if sys.getwindowsversion()[:2] >= (6, 0): - from nt import _getfinalpathname - else: - raise ImportError -except (AttributeError, ImportError): - # On Windows XP and earlier, two files are the same if their absolute - # pathnames are the same. - # Non-Windows operating systems fake this method with an XP - # approximation. - def _getfinalpathname(f): - return normcase(abspath(f)) - - try: # The genericpath.isdir implementation uses os.stat and checks the mode # attribute to tell whether or not the path is a directory. diff -r e8f40d4f497c Modules/posixmodule.c --- a/Modules/posixmodule.c Tue Jan 22 10:32:16 2013 +0200 +++ b/Modules/posixmodule.c Tue Jan 22 14:27:53 2013 +0200 @@ -3447,70 +3447,6 @@ } /* end of posix__getfullpathname */ - -/* A helper function for samepath on windows */ -static PyObject * -posix__getfinalpathname(PyObject *self, PyObject *args) -{ - HANDLE hFile; - int buf_size; - wchar_t *target_path; - int result_length; - PyObject *po, *result; - wchar_t *path; - - if (!PyArg_ParseTuple(args, "U|:_getfinalpathname", &po)) - return NULL; - path = PyUnicode_AsUnicode(po); - if (path == NULL) - return NULL; - - if(!check_GetFinalPathNameByHandle()) { - /* If the OS doesn't have GetFinalPathNameByHandle, return a - NotImplementedError. */ - return PyErr_Format(PyExc_NotImplementedError, - "GetFinalPathNameByHandle not available on this platform"); - } - - hFile = CreateFileW( - path, - 0, /* desired access */ - 0, /* share mode */ - NULL, /* security attributes */ - OPEN_EXISTING, - /* FILE_FLAG_BACKUP_SEMANTICS is required to open a directory */ - FILE_FLAG_BACKUP_SEMANTICS, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - return win32_error_object("CreateFileW", po); - - /* We have a good handle to the target, use it to determine the - target path name. */ - buf_size = Py_GetFinalPathNameByHandleW(hFile, 0, 0, VOLUME_NAME_NT); - - if(!buf_size) - return win32_error_object("GetFinalPathNameByHandle", po); - - target_path = (wchar_t *)malloc((buf_size+1)*sizeof(wchar_t)); - if(!target_path) - return PyErr_NoMemory(); - - result_length = Py_GetFinalPathNameByHandleW(hFile, target_path, - buf_size, VOLUME_NAME_DOS); - if(!result_length) - return win32_error_object("GetFinalPathNamyByHandle", po); - - if(!CloseHandle(hFile)) - return win32_error_object("CloseHandle", po); - - target_path[result_length] = 0; - result = PyUnicode_FromWideChar(target_path, result_length); - free(target_path); - return result; - -} /* end of posix__getfinalpathname */ - PyDoc_STRVAR(posix__isdir__doc__, "Return true if the pathname refers to an existing directory."); @@ -10588,7 +10524,6 @@ {"abort", posix_abort, METH_NOARGS, posix_abort__doc__}, #ifdef MS_WINDOWS {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL}, - {"_getfinalpathname", posix__getfinalpathname, METH_VARARGS, NULL}, {"_isdir", posix__isdir, METH_VARARGS, posix__isdir__doc__}, {"_getdiskusage", win32__getdiskusage, METH_VARARGS, win32__getdiskusage__doc__}, #endif