Fix asyncio issue (3.4.3+)
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
e4689f3eb1
commit
f5c1ad4f49
@ -0,0 +1,41 @@
|
||||
From 5e6e0ad21acfed32c57ae8ef23a8a0722869afe1 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Kluyver <takowl@gmail.com>
|
||||
Date: Tue, 13 Oct 2015 12:41:09 +0100
|
||||
Subject: [PATCH] Stop asyncio listening to pty once we've found what we need
|
||||
|
||||
Closes gh-213 (fingers crossed)
|
||||
---
|
||||
pexpect/async.py | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/pexpect/async.py b/pexpect/async.py
|
||||
index a798457..136fc0e 100644
|
||||
--- a/pexpect/async.py
|
||||
+++ b/pexpect/async.py
|
||||
@@ -23,6 +23,7 @@ def expect_async(expecter, timeout=None):
|
||||
return expecter.timeout(e)
|
||||
|
||||
class PatternWaiter(asyncio.Protocol):
|
||||
+ transport = None
|
||||
def __init__(self, expecter):
|
||||
self.expecter = expecter
|
||||
self.fut = asyncio.Future()
|
||||
@@ -30,10 +31,15 @@ class PatternWaiter(asyncio.Protocol):
|
||||
def found(self, result):
|
||||
if not self.fut.done():
|
||||
self.fut.set_result(result)
|
||||
+ self.transport.pause_reading()
|
||||
|
||||
def error(self, exc):
|
||||
if not self.fut.done():
|
||||
self.fut.set_exception(exc)
|
||||
+ self.transport.pause_reading()
|
||||
+
|
||||
+ def connection_made(self, transport):
|
||||
+ self.transport = transport
|
||||
|
||||
def data_received(self, data):
|
||||
spawn = self.expecter.spawn
|
||||
--
|
||||
2.6.1
|
||||
|
@ -1,10 +0,0 @@
|
||||
diff --git a/tests/test_async.py b/tests/test_async.py
|
||||
index ce75572..7bee98f 100644
|
||||
--- a/tests/test_async.py
|
||||
+++ b/tests/test_async.py
|
||||
@@ -48,4 +48,4 @@ class AsyncTests(PexpectTestCase):
|
||||
p = pexpect.spawn('%s list100.py' % sys.executable)
|
||||
assert run(p.expect_exact(b'5', async=True)) == 0
|
||||
assert run(p.expect_exact(['wpeok', b'11'], async=True)) == 1
|
||||
- assert run(p.expect_exact([b'foo', pexpect.EOF], async=True)) == 1
|
||||
+ #assert run(p.expect_exact([b'foo', pexpect.EOF], async=True)) == 1
|
@ -3,12 +3,12 @@
|
||||
Summary: Unicode-aware Pure Python Expect-like module
|
||||
Name: python-%{modname}
|
||||
Version: 4.0.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: MIT
|
||||
URL: https://github.com/%{modname}/%{modname}
|
||||
Source0: https://github.com/%{modname}/%{modname}/archive/%{version}/%{modname}-%{version}.tar.gz
|
||||
|
||||
Patch0: pexpect-4.0.1-disable-some-tests.patch
|
||||
Patch0: 0001-Stop-asyncio-listening-to-pty-once-we-ve-found-what-.patch
|
||||
Patch1: 0001-disable-max-canon-tests-retain-file-contents.patch
|
||||
Patch2: 0002-2-new-tools-display-fpathconf.maxcanon-.py.patch
|
||||
|
||||
@ -135,6 +135,9 @@ popd
|
||||
%{python3_sitelib}/%{modname}*
|
||||
|
||||
%changelog
|
||||
* Tue Oct 13 2015 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.0.1-3
|
||||
- Fix asyncio issue (3.4.3+)
|
||||
|
||||
* Thu Oct 08 2015 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.0.1-2
|
||||
- Fix RPM macroses
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user