GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio by kumaraditya303 · Pull Request #120805 · python/cpython

GH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio #120805

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.

Sign up for GitHub

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
kumaraditya303 merged 3 commits into python:main from kumaraditya303:watcher
Jun 21, 2024

Uh oh!

There was an error while loading. Please reload this page.

Merged

GH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio #120805

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
aef6431
Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher f…
kumaraditya303 Jun 20, 2024
45c43bc
remove tests
kumaraditya303 Jun 20, 2024
9249dd8
fixup tests
kumaraditya303 Jun 20, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
fixup tests
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
kumaraditya303 committed Jun 20, 2024
commit 9249dd8e8a23aaba89dbeec0daf2f7ffef630cd9

There are no files selected for viewing

9 changes: 1 addition & 8 deletions 9 Lib/test/test_asyncio/test_events.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ def setUp(self):
super().setUp()
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
watcher = asyncio.SafeChildWatcher()
watcher = asyncio.ThreadedChildWatcher()
watcher.attach_loop(self.loop)
asyncio.set_child_watcher(watcher)

Expand Down Expand Up @@ -2833,13 +2833,6 @@ def setUp(self):
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)

if sys.platform != 'win32':
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
watcher = asyncio.SafeChildWatcher()
watcher.attach_loop(self.loop)
asyncio.set_child_watcher(watcher)

def tearDown(self):
try:
if sys.platform != 'win32':
Expand Down
46 changes: 0 additions & 46 deletions 46 Lib/test/test_asyncio/test_streams.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -822,52 +822,6 @@ async def client(addr):
self.assertEqual(msg1, b"hello world 1!\n")
self.assertEqual(msg2, b"hello world 2!\n")

@unittest.skipIf(sys.platform == 'win32', "Don't have pipes")
@requires_subprocess()
def test_read_all_from_pipe_reader(self):
# See asyncio issue 168. This test is derived from the example
# subprocess_attach_read_pipe.py, but we configure the
# StreamReader's limit so that twice it is less than the size
# of the data writer. Also we must explicitly attach a child
# watcher to the event loop.

code = """\
import os, sys
fd = int(sys.argv[1])
os.write(fd, b'data')
os.close(fd)
"""
rfd, wfd = os.pipe()
args = [sys.executable, '-c', code, str(wfd)]

pipe = open(rfd, 'rb', 0)
reader = asyncio.StreamReader(loop=self.loop, limit=1)
protocol = asyncio.StreamReaderProtocol(reader, loop=self.loop)
transport, _ = self.loop.run_until_complete(
self.loop.connect_read_pipe(lambda: protocol, pipe))
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
watcher = asyncio.SafeChildWatcher()
watcher.attach_loop(self.loop)
try:
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
asyncio.set_child_watcher(watcher)
create = asyncio.create_subprocess_exec(
*args,
pass_fds={wfd},
)
proc = self.loop.run_until_complete(create)
self.loop.run_until_complete(proc.wait())
finally:
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
asyncio.set_child_watcher(None)

os.close(wfd)
data = self.loop.run_until_complete(reader.read(-1))
self.assertEqual(data, b'data')

def test_streamreader_constructor_without_loop(self):
with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
asyncio.StreamReader()
Expand Down
9 changes: 0 additions & 9 deletions 9 Lib/test/test_asyncio/test_subprocess.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -631,15 +631,6 @@ async def kill_running():
# the transport was not notified yet
self.assertFalse(killed)

# Unlike SafeChildWatcher, FastChildWatcher does not pop the
# callbacks if waitpid() is called elsewhere. Let's clear them
# manually to avoid a warning when the watcher is detached.
if (sys.platform != 'win32' and
isinstance(self, SubprocessFastWatcherTests)):
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
asyncio.get_child_watcher()._callbacks.clear()

async def _test_popen_error(self, stdin):
if sys.platform == 'win32':
target = 'asyncio.windows_utils.Popen'
Expand Down
64 changes: 0 additions & 64 deletions 64 Lib/test/test_asyncio/test_unix_events.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1167,70 +1167,6 @@ def test_get_default_child_watcher(self, m_can_use_pidfd):
with self.assertWarns(DeprecationWarning):
self.assertIs(watcher, policy.get_child_watcher())

def test_get_child_watcher_after_set(self):
policy = self.create_policy()
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
watcher = asyncio.FastChildWatcher()
policy.set_child_watcher(watcher)

self.assertIs(policy._watcher, watcher)
with self.assertWarns(DeprecationWarning):
self.assertIs(watcher, policy.get_child_watcher())

def test_get_child_watcher_thread(self):

def f():
policy.set_event_loop(policy.new_event_loop())

self.assertIsInstance(policy.get_event_loop(),
asyncio.AbstractEventLoop)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
watcher = policy.get_child_watcher()

self.assertIsInstance(watcher, asyncio.SafeChildWatcher)
self.assertIsNone(watcher._loop)

policy.get_event_loop().close()

policy = self.create_policy()
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
policy.set_child_watcher(asyncio.SafeChildWatcher())

th = threading.Thread(target=f)
th.start()
th.join()

def test_child_watcher_replace_mainloop_existing(self):
policy = self.create_policy()
loop = policy.new_event_loop()
policy.set_event_loop(loop)

# Explicitly setup SafeChildWatcher,
# default ThreadedChildWatcher has no _loop property
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
watcher = asyncio.SafeChildWatcher()
policy.set_child_watcher(watcher)
watcher.attach_loop(loop)

self.assertIs(watcher._loop, loop)

new_loop = policy.new_event_loop()
policy.set_event_loop(new_loop)

self.assertIs(watcher._loop, new_loop)

policy.set_event_loop(None)

self.assertIs(watcher._loop, None)

loop.close()
new_loop.close()


class TestFunctional(unittest.TestCase):

def setUp(self):
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.