[issue44705] Support Windows file open modes for `open` built-in function

2021-07-22 Thread Eryk Sun


Eryk Sun  added the comment:

Currently you can use os.open() if you need platform-specific open flags such 
as Windows O_RANDOM, O_SEQUENTIAL, O_SHORT_LIVED, and O_TEMPORARY. The file 
descriptor can be passed to builtin open() to get a file object that owns the 
fd.

It might be more convenient if the os module had a function to translate an 
open() mode string into a combination of the flags O_RDONLY, O_WRONLY, O_RDWR, 
O_CREAT, O_TRUNC, O_EXCL, and O_APPEND. Plus O_BINARY in Windows.

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44705] Support Windows file open modes for `open` built-in function

2021-07-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44705] Support Windows file open modes for `open` built-in function

2021-07-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
versions:  -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44705] Support Windows file open modes for `open` built-in function

2021-07-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +methane

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44705] Support Windows file open modes for `open` built-in function

2021-07-21 Thread Luke Deller


New submission from Luke Deller :

Microsoft Windows supports some extra file open modes including:
 "S"Specifies that caching is optimized for, but not restricted to, 
sequential access from disk.
 "T"Specifies a file as temporary. If possible, it is not flushed to disk.
 "D"Specifies a file as temporary. It is deleted when the last file pointer 
is closed

Python 2 used to allow "T" and "D" flags in the built-in `open` function 
(though this was not documented):
https://github.com/python/cpython/blob/2.7/Objects/fileobject.c#L214

It would be great if these flags were allowed in Python 3.

I see that Python3 implementation uses `open`/`_wopen` rather than `fopen` now. 
 The mapping to numeric flags for `_wopen` is shown in the documentation here:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen 
(search for "Equivalent oflag value")

--
components: IO
messages: 397971
nosy: lukedeller1
priority: normal
severity: normal
status: open
title: Support Windows file open modes for `open` built-in function
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com