diff -r 1c5e0dbcb2a0 Modules/posixmodule.c --- a/Modules/posixmodule.c Sun Sep 25 16:54:17 2016 +0300 +++ b/Modules/posixmodule.c Sun Sep 25 12:59:55 2016 -0400 @@ -6997,6 +6997,7 @@ char target_buffer[_Py_MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; _Py_REPARSE_DATA_BUFFER *rdb = (_Py_REPARSE_DATA_BUFFER *)target_buffer; const wchar_t *print_name; + USHORT print_name_length; static char *keywords[] = {"path", "dir_fd", NULL}; @@ -7041,17 +7042,27 @@ if (io_result==0) return win32_error_object("readlink", po); - if (rdb->ReparseTag != IO_REPARSE_TAG_SYMLINK) - { - PyErr_SetString(PyExc_ValueError, - "not a symbolic link"); - return NULL; - } - print_name = rdb->SymbolicLinkReparseBuffer.PathBuffer + - rdb->SymbolicLinkReparseBuffer.PrintNameOffset; + if(rdb->ReparseTag == IO_REPARSE_TAG_SYMLINK) + { + print_name = rdb->SymbolicLinkReparseBuffer.PathBuffer + + (rdb->SymbolicLinkReparseBuffer.PrintNameOffset / 2); + print_name_length = rdb->SymbolicLinkReparseBuffer.PrintNameLength / 2; + } + else if(rdb->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) + { + print_name = rdb->MountPointReparseBuffer.PathBuffer + + (rdb->MountPointReparseBuffer.PrintNameOffset / 2); + print_name_length = rdb->MountPointReparseBuffer.PrintNameLength / 2; + } + else + { + PyErr_SetString(PyExc_ValueError, + "not a symbolic link"); + return NULL; + } result = PyUnicode_FromWideChar(print_name, - rdb->SymbolicLinkReparseBuffer.PrintNameLength/2); + print_name_length); return result; } diff -r 1c5e0dbcb2a0 Python/fileutils.c --- a/Python/fileutils.c Sun Sep 25 16:54:17 2016 +0300 +++ b/Python/fileutils.c Sun Sep 25 12:59:55 2016 -0400 @@ -584,7 +584,7 @@ FILE_TIME_to_time_t_nsec(&info->ftLastAccessTime, &result->st_atime, &result->st_atime_nsec); result->st_nlink = info->nNumberOfLinks; result->st_ino = (((__int64)info->nFileIndexHigh)<<32) + info->nFileIndexLow; - if (reparse_tag == IO_REPARSE_TAG_SYMLINK) { + if (reparse_tag == IO_REPARSE_TAG_SYMLINK || reparse_tag == IO_REPARSE_TAG_MOUNT_POINT) { /* first clear the S_IFMT bits */ result->st_mode ^= (result->st_mode & S_IFMT); /* now set the bits that make this a symlink */