Message377824
The mode string is calculated here: https://github.com/python/cpython/blob/master/Modules/_io/fileio.c#L1055
and is based on these four values in the fileio struct:
unsigned int created : 1;
unsigned int readable : 1;
unsigned int writable : 1;
unsigned int appending : 1;
This is not enough information to distinguish between r+ and w+. That distinction was lost in _io_FileIO___init___impl, where it specified the flags that went into creating fd, but these flags are not saved.
The bit fields in this struct add up to 7 bits, so it seems possible to fix this if another bit is allocated for this purpose.
If it's not worth it, then the documentation needs to change a little. |
|
Date |
User |
Action |
Args |
2020-10-02 17:19:20 | iritkatriel | set | recipients:
+ iritkatriel, benjamin.peterson, stutzbach, docs@python, mike.parker |
2020-10-02 17:19:20 | iritkatriel | set | messageid: <1601659160.82.0.144299693004.issue40391@roundup.psfhosted.org> |
2020-10-02 17:19:20 | iritkatriel | link | issue40391 messages |
2020-10-02 17:19:20 | iritkatriel | create | |
|