10000 gh-76785: Add *Channel.is_closed by ericsnowcurrently · Pull Request #110606 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-76785: Add *Channel.is_closed #110606

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 6 commits into from
Oct 19, 2023
Merged
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
Add *Channel.is_closed().
  • Loading branch information
ericsnowcurrently committed Oct 17, 2023
commit a70509a9250ed295792987551268f593e6795bc0
9 changes: 9 additions & 0 deletions Lib/test/support/interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def id(self):
def _info(self):
return _channels.get_info(self._id)

@property
def is_closed(self):
return self._info.closed


_NOT_SET = object()

Expand Down Expand Up @@ -217,6 +221,11 @@ class SendChannel(_ChannelEnd):

_end = 'send'

@property
def is_closed(self):
info = self._info
return info.closed or info.closing

def send(self, obj, timeout=None):
"""Send the object (i.e. its data) to the channel's receiving end.

Expand Down
0