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

2019-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I considered this. There is a limited number of functions that can produce RawFD (os.open(), os.dup(), etc), and this is a single source of file descriptors in an isolated program. File descriptors can be inherited by child processes. But there are other m

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

2019-11-12 Thread Zufu Liu
Zufu Liu added the comment: I'm fine with this been closed. Maybe it's better to have a RawFd type like Julia: julia> RawFD RawFD julia> typeof(RawFD) DataType julia> RawFD(0) RawFD(0x) julia> RawFD(0)==0 false Rust has RawFd as c_int. -- _

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

2019-11-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pyth

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

2019-11-12 Thread Anj-A
Anj-A <2017...@gmail.com> added the comment: Hey, if there is no bug here, could we get this issue closed? Alternatively, I'd be interested in doing the required change in documentation/error type if that's seen to be the right solution. Personally, I think returning False instead of raising a

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

2019-11-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure there is much in common between this and issue33721. There are many ways to get a file path unrepresentable at the OS level. But I do not know any valid case for getting an out-of-range file descriptor. I am not convinced there is a bug here.

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

2019-11-04 Thread Anj-A
Anj-A <2017...@gmail.com> added the comment: Hey, I'm not exactly clear what the required fix is here and would appreciate some guidance, is it in the documentation or in the way the error is handled? -- ___ Python tracker

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

2019-11-04 Thread STINNER Victor
STINNER Victor added the comment: This issue reminds me bpo-33721: "os.path functions that return a boolean result like exists(), lexists(), isdir(), isfile(), islink(), and ismount() now return False instead of raising ValueError or its subclasses UnicodeEncodeError and UnicodeDecodeError f

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

2019-11-04 Thread Anj-A
Anj-A <2017...@gmail.com> added the comment: Hi all, I'm a newcomer interested in doing a small fix. Wondering if anyone's working on this at the moment? -- nosy: +Anj-A ___ Python tracker __

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

2019-07-01 Thread Zufu Liu
Zufu Liu added the comment: Please also consider following pieces of code. They (value of int sub classes) can't be returned by fileno(). Python 3.8.0b1 (tags/v3.8.0b1:3b5deb0116, Jun 4 2019, 19:52:55) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for

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

2019-07-01 Thread Zufu Liu
Zufu Liu added the comment: Personally I prefer TypeError. Use file descriptor is rare, I never used it in Python script. I encountered this because arguments passed in wrong order in my function, then I passed the wrong argument to isfile() without checking. Make isfile() returns False would

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

2019-07-01 Thread Steve Dower
Steve Dower 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

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

2019-06-27 Thread Aldwin Pollefeyt
Aldwin Pollefeyt 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,

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

2019-06-27 Thread Zufu Liu
New submission from Zufu Liu : I think it's should be TypeError as Python 2.7. The doc https://docs.python.org/3/library/os.path.html doesn't says it accept file descriptor. Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright",