[New-bugs-announce] [issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

Roman Kozhemiakin report at bugs.python.org
Mon Nov 16 16:42:09 EST 2015


New submission from Roman Kozhemiakin:

open('\\\\.\\PHYSICALDRIVE1','rb',0)
fails since python 3.5

At the end of _io_FileIO___init___impl function 
_Py_fstat call raise OSError: [WinError 1] Incorrect function
_Py_fstat result not used on windows in this place. 

     440     self->blksize = DEFAULT_BUFFER_SIZE;
---> 441     if (_Py_fstat(self->fd, &fdfstat) < 0)
     442         goto error;
     443 #if defined(S_ISDIR) && defined(EISDIR)
     444     /* On Unix, open will succeed for directories.
     445        In Python, there should be no file objects referring to
     446        directories, so we need a check.  */
     447     if (S_ISDIR(fdfstat.st_mode)) {
     448         errno = EISDIR;
     449         PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, nameobj);
     450         goto error;
     451     }
     452 #endif /* defined(S_ISDIR) */
     453 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
     454     if (fdfstat.st_blksize > 1)
     455         self->blksize = fdfstat.st_blksize;
     456 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */

----------
components: Library (Lib)
messages: 254756
nosy: rokozh
priority: normal
severity: normal
status: open
title: open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25639>
_______________________________________


More information about the New-bugs-announce mailing list