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 <rep...@bugs.python.org>
<http://bugs.python.org/issue25639>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to