GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||
GeezerVison is showing github.com — gh-124405: Fix `NameError` in `openpty` by sobolevn · Pull Request #124406 · python/cpython Conversation
|
Thanks for the review! I need help adding tests, since I cannot reproduce this on my machine :( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm going to sleep now, will look tomorrow. Based on typeshed I_PUSH should exist on Linux?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
"highly problematic" indeed ;-) https://github.com/python/typeshed/pull/6807/files#diff-f28c4d3b27ed19db8e4154e55b1ad119f6655aad863bd3e92d9aee2d481589d7R72 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I tried to test this change by removing import os import pty del os.openpty master_fd, slave_fd = pty.openpty() os.close(master_fd) os.close(slave_fd) But it fails on Linux with: Traceback (most recent call last): File "/home/vstinner/python/main/x.py", line 4, in <module> master_fd, slave_fd = pty.openpty() ~~~~~~~~~~~^^ File "/home/vstinner/python/main/Lib/pty.py", line 34, in openpty master_fd, slave_name = _open_terminal() ~~~~~~~~~~~~~~^^ File "/home/vstinner/python/main/Lib/pty.py", line 58, in _open_terminal raise OSError('out of pty devices') OSError: out of pty devices On my Fedora 41, I have no It seems like os.openpty() is implemented by communicating with |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Same on FreeBSD. On FreeBSD, os.openpty() is implemented with (syscalls recorded by truss): |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I guess that os.openpty() is now commonly available, and nobody uses the _open_terminal() fallback code path anymore, which looks broken on most platforms. We should maybe do something with this code. Deprecate it. Remove it. I don't know :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@vstinner thanks a lot for your help! 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.