Skip to content

gh-85984: Add POSIX pseudo-terminal functions.#102413

Merged
encukou merged 14 commits intopython:mainfrom
8vasu:posix_pt
Jan 29, 2024
Merged

gh-85984: Add POSIX pseudo-terminal functions.#102413
encukou merged 14 commits intopython:mainfrom
8vasu:posix_pt

Conversation

@8vasu
Copy link
Contributor

@8vasu 8vasu commented Mar 4, 2023

This follows #101831. This is one in a series of PRs aimed at cleaning-up, fixing bugs in, introducing new features in, and updating the code in "Lib/pty.py".

This PR answers the following question: os.forkpty() and pty.fork() return a pair pid, fd, where fd is a file descriptor of the master end of a pseudo-terminal pair; if at a later stage one needs to make some modifications to the slave end (such as setting termios attributes), then how does one obtain access to it without reimplementing ptsname() in Python or loading it from a shared library like someone is doing here: https://stackoverflow.com/questions/52338062/calling-libc-select-from-python-from-pty-master-side?

This is a dependency of #101833, which only needs os.ptsname(). However, this PR also adds os.posix_openpt(), os.grantpt(), and os.unlockpt() since all of these POSIX functions are "companions" of each other.

Signed-off-by: Soumendra Ganguly soumendraganguly@gmail.com

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension-modules C modules in the Modules dir topic-IO type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants