[issue37436] os.path.isfile() with big number cause OverflowError: fd is greater than maximum

Aldwin Pollefeyt report at bugs.python.org
Fri Jun 28 01:13:58 EDT 2019


Aldwin Pollefeyt <aldwinaldwin at gmail.com> added the comment:

Integers seems to be accepted, so not a TypeError? Maybe documentation needs some more information. 


Documentation os.path under os.path.exists(path):

Changed in version 3.3: path can now be an integer: True is returned if it is an open file descriptor, False otherwise.


in posixmodule.c:

 * path_converter also optionally accepts signed
 * integers (representing open file descriptors) instead
 * of path strings.


although i dunno how to use then:

$ echo "test" > 123
$ ls -i 123
8012691 123
$ ./python -c "import os.path; print(os.path.isfile(8012691))"
False
$ ./python -c "import os.path; print(os.path.isfile('123'))"
True

----------
nosy: +aldwinaldwin

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37436>
_______________________________________


More information about the Python-bugs-list mailing list