Steve Dower <steve.do...@python.org> added the comment:
You use this by getting the file descriptor/fileno for an open file, and then testing whether it's a file or not: >>> f=open("python.bat") >>> f.fileno() 3 >>> import os >>> os.path.isfile(3) True This is very uncommon on Windows to begin with (file descriptors are emulated by the C Runtime for POSIX compatibility), but it is supported. Enabling Modules/posixmodule.c#L2446 to be able to optionally handle the OverflowError would allow the "exists" type functions to just return False instead of raising, while letting the others continue to raise. I'm going to mark this as "easy (C)" so that we consider it for sprints. But in principle, I'm okay with returning False for invalid values in exists-type functions rather than raising. ---------- components: +Argument Clinic -Library (Lib), Windows keywords: +easy (C) nosy: +larry versions: +Python 3.9 -Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37436> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com