Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 14 commits into from
Jan 29, 2024
51 changes: 51 additions & 0 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,19 @@
.. versionchanged:: 3.12
Added support for pipes on Windows.


.. function:: grantpt(fd, /)

Grant access to the slave pseudo-terminal device associated with the
master pseudo-terminal device to which the file descriptor *fd* refers.

Calls the C standard library function :c:func:`grantpt`.

Check warning on line 1131 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: grantpt

.. availability:: Unix, not Emscripten, not WASI.

.. versionadded:: 3.13


.. function:: isatty(fd, /)

Return ``True`` if the file descriptor *fd* is open and connected to a
Expand Down Expand Up @@ -1429,6 +1442,19 @@
.. versionadded:: 3.3


.. function:: posix_openpt(oflag, /)

Open and return a file descriptor for a master pseudo-terminal device.

Calls the C standard library function :c:func:`posix_openpt`. The *oflag*

Check warning on line 1449 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: posix_openpt

Check warning on line 1449 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: posix_openpt
gpshead marked this conversation as resolved.
Show resolved Hide resolved
argument is used to set file status flags and file access modes as
specified in the manual page of :c:func:`posix_openpt` of your system.
encukou marked this conversation as resolved.
Show resolved Hide resolved

.. availability:: Unix, not Emscripten, not WASI.

.. versionadded:: 3.13


.. function:: preadv(fd, buffers, offset, flags=0, /)

Read from a file descriptor *fd* at a position of *offset* into mutable
Expand Down Expand Up @@ -1486,6 +1512,19 @@
.. versionadded:: 3.7


.. function:: ptsname(fd, /)

Return the name of the slave pseudo-terminal device associated with the
master pseudo-terminal device to which the file descriptor *fd* refers.

Calls the C standard library function :c:func:`ptsname`, which is not

Check warning on line 1520 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: ptsname
guaranteed to be thread-safe.

.. availability:: Unix, not Emscripten, not WASI.

.. versionadded:: 3.13


.. function:: pwrite(fd, str, offset, /)

Write the bytestring in *str* to file descriptor *fd* at position of
Expand Down Expand Up @@ -1738,6 +1777,18 @@
.. availability:: Unix.


.. function:: unlockpt(fd, /)

Unlock the slave pseudo-terminal device associated with the master
pseudo-terminal device to which the file descriptor *fd* refers.

Calls the C standard library function :c:func:`unlockpt`.

Check warning on line 1785 in Doc/library/os.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: unlockpt

.. availability:: Unix, not Emscripten, not WASI.

.. versionadded:: 3.13


.. function:: write(fd, str, /)

Write the bytestring in *str* to file descriptor *fd*.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add POSIX pseudo-terminal functions :func:`os.posix_openpt`,
:func:`os.grantpt`, :func:`os.unlockpt`, and :func:`os.ptsname`.
167 changes: 166 additions & 1 deletion Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading