summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/pexpect/files/pexpect-4.8.0-py311.patch')
-rw-r--r--dev-python/pexpect/files/pexpect-4.8.0-py311.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/dev-python/pexpect/files/pexpect-4.8.0-py311.patch b/dev-python/pexpect/files/pexpect-4.8.0-py311.patch
new file mode 100644
index 000000000000..b7de17a68785
--- /dev/null
+++ b/dev-python/pexpect/files/pexpect-4.8.0-py311.patch
@@ -0,0 +1,67 @@
+From 52af5b0ae0627139524448a3f2e83d9f40802bc2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 24 Mar 2022 15:15:33 +0100
+Subject: [PATCH] Convert @asyncio.coroutine to async def
+
+This is required for Python 3.11+ support.
+
+Fixes https://github.com/pexpect/pexpect/issues/677
+---
+ pexpect/_async.py | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/pexpect/_async.py b/pexpect/_async.py
+index dfbfeef5..bc83261d 100644
+--- a/pexpect/_async.py
++++ b/pexpect/_async.py
+@@ -4,8 +4,7 @@
+
+ from pexpect import EOF
+
+-@asyncio.coroutine
+-def expect_async(expecter, timeout=None):
++async def expect_async(expecter, timeout=None):
+ # First process data that was previously read - if it maches, we don't need
+ # async stuff.
+ idx = expecter.existing_data()
+@@ -14,7 +13,7 @@ def expect_async(expecter, timeout=None):
+ if not expecter.spawn.async_pw_transport:
+ pw = PatternWaiter()
+ pw.set_expecter(expecter)
+- transport, pw = yield from asyncio.get_event_loop()\
++ transport, pw = await asyncio.get_event_loop()\
+ .connect_read_pipe(lambda: pw, expecter.spawn)
+ expecter.spawn.async_pw_transport = pw, transport
+ else:
+@@ -22,26 +21,25 @@ def expect_async(expecter, timeout=None):
+ pw.set_expecter(expecter)
+ transport.resume_reading()
+ try:
+- return (yield from asyncio.wait_for(pw.fut, timeout))
++ return (await asyncio.wait_for(pw.fut, timeout))
+ except asyncio.TimeoutError as e:
+ transport.pause_reading()
+ return expecter.timeout(e)
+
+-@asyncio.coroutine
+-def repl_run_command_async(repl, cmdlines, timeout=-1):
++async def repl_run_command_async(repl, cmdlines, timeout=-1):
+ res = []
+ repl.child.sendline(cmdlines[0])
+ for line in cmdlines[1:]:
+- yield from repl._expect_prompt(timeout=timeout, async_=True)
++ await repl._expect_prompt(timeout=timeout, async_=True)
+ res.append(repl.child.before)
+ repl.child.sendline(line)
+
+ # Command was fully submitted, now wait for the next prompt
+- prompt_idx = yield from repl._expect_prompt(timeout=timeout, async_=True)
++ prompt_idx = await repl._expect_prompt(timeout=timeout, async_=True)
+ if prompt_idx == 1:
+ # We got the continuation prompt - command was incomplete
+ repl.child.kill(signal.SIGINT)
+- yield from repl._expect_prompt(timeout=1, async_=True)
++ await repl._expect_prompt(timeout=1, async_=True)
+ raise ValueError("Continuation prompt found - input was incomplete:")
+ return u''.join(res + [repl.child.before])
+