This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients benjamin.peterson, docs@python, iritkatriel, mike.parker, stutzbach
Date 2020-10-02.17:19:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601659160.82.0.144299693004.issue40391@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-10-02 17:19:20iritkatrielsetrecipients: + iritkatriel, benjamin.peterson, stutzbach, docs@python, mike.parker
2020-10-02 17:19:20iritkatrielsetmessageid: <1601659160.82.0.144299693004.issue40391@roundup.psfhosted.org>
2020-10-02 17:19:20iritkatriellinkissue40391 messages
2020-10-02 17:19:20iritkatrielcreate