8000 gh-118824: Remove deprecated `master_open` and `slave_open` from `pty` by sobolevn · Pull Request #118826 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-118824: Remove deprecated master_open and slave_open from pty #118826

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

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review
  • Loading branch information
sobolevn committed May 9, 2024
commit 95fc77b4a6025c9f3c5c6783acdd308f74fd7c0c
12 changes: 10 additions & 2 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ email
* The *isdst* parameter has been removed from :func:`email.utils.localtime`.
(Contributed by Hugo van Kemenade in :gh:`118798`.)

pty
___

* Remove deprecated ``pty.master_open`` and ``pty.slave_open``.
They had previously raised a :exc:`DeprecationWarning` since Python 3.12.

Others
------

Expand All @@ -118,8 +124,10 @@ Others
are removed. They had previously raised a :exc:`DeprecationWarning`
since Python 3.12.

* Remove deprecated ``pty.master_open`` and ``pty.slave_open``.
They had previously raised a :exc:`DeprecationWarning` since Python 3.12.
* :mod:`itertools` support for copy, deepcopy, and pickle operations.
These had previously raised a :exc:`DeprecationWarning` since Python 3.12.
(Contributed by Raymond Hettinger in :gh:`101588`.)


Porting to Python 3.14
======================
Expand Down
12 changes: 11 additions & 1 deletion Lib/pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ def openpty():
except (AttributeError, OSError):
pass
master_fd, slave_name = _open_terminal()
slave_fd = slave_open(slave_name)

slave_fd = os.open(slave_name, os.O_RDWR)
try:
from fcntl import ioctl, I_PUSH
except ImportError:
return master_fd, slave_fd
try:
ioctl(result, I_PUSH, "ptem")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result is a NameError now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #124406

ioctl(result, I_PUSH, "ldterm")
except OSError:
pass
return master_fd, slave_fd

def _open_terminal():
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0