[issue45944] Avoid calling isatty() for most open() calls

2021-12-01 Thread Eryk Sun
Eryk Sun added the comment: > make it returning False without invoking a system call if the file > size is non-zero it will eliminate the need to expose _size. I suggest using the file type instead of the size. There's no reason to call isatty() if it's not an S_IFCHR file. This will avoid ca

[issue45944] Avoid calling isatty() for most open() calls

2021-12-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +benjamin.peterson, pitrou, stutzbach versions: -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___ _

[issue45944] Avoid calling isatty() for most open() calls

2021-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What if change FileIO.isatty() instead? If make it returning False without invoking a system call if the file size is non-zero it will eliminate the need to expose _size. -- nosy: +serhiy.storchaka ___ Python tr

[issue45944] Avoid calling isatty() for most open() calls

2021-11-30 Thread Collin Anderson
New submission from Collin Anderson : isatty() is a system call on linux. Most open()s are files, and we're already getting the size of the file. If it has a size, then we know it's not a atty, and can avoid calling it. -- ___ Python tracker

[issue45944] Avoid calling isatty() for most open() calls

2021-11-30 Thread Collin Anderson
Change by Collin Anderson : -- keywords: +patch pull_requests: +28096 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29870 ___ Python tracker ___

[issue45944] Avoid calling isatty() for most open() calls

2021-11-30 Thread Collin Anderson
Change by Collin Anderson : -- components: IO nosy: collinanderson priority: normal severity: normal status: open title: Avoid calling isatty() for most open() calls type: performance versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 __