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 eryksun
Recipients Mariano Anaya, Nika, eryksun
Date 2019-10-11.12:17:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1570796247.75.0.235295203615.issue38445@roundup.psfhosted.org>
In-reply-to
Content
Note that the underlying stat call supports file descriptors, which are non-negative integers. This is a supported and tested capability for genericpath.exists (see GenericTest.test_exists_fd in Lib/test/test_genericpath.py).

False and True are integers with the values 0 and 1: 

    >>> issubclass(bool, int)
    True
    >>> False + 0
    0
    >>> True + 0
    1

That can be useful, but there may be cases where we don't want to conflate bools and integers. IMO, a bool should not be supported as a file descriptor. It's likely a bug that should be caught early instead of meaninglessly propagated. 

A high-level solution would check for bool instances in genericpath.exists. A low-level solution, to make this policy consistent in general, would be to modify _fd_converter in Modules/posixmodule.c to disallow bool instances.
History
Date User Action Args
2019-10-11 12:17:27eryksunsetrecipients: + eryksun, Mariano Anaya, Nika
2019-10-11 12:17:27eryksunsetmessageid: <1570796247.75.0.235295203615.issue38445@roundup.psfhosted.org>
2019-10-11 12:17:27eryksunlinkissue38445 messages
2019-10-11 12:17:27eryksuncreate