diff options
author | David Shea <dshea@redhat.com> | 2015-07-30 13:07:59 -0400 |
---|---|---|
committer | David Shea <dshea@redhat.com> | 2015-07-30 13:07:59 -0400 |
commit | 7cadf489f82f82a756406caafa9e331d1efa82d5 (patch) | |
tree | 831840937f23efbe4b845abc7a7b8bf162153dcb | |
parent | d67c49d2e5c0744ad267f6dd9a138347ccde2bc9 (diff) | |
download | astroid-py3-communicate.tar.gz |
Add a timeout parameter to Popen.communicate in PY3K.py3-communicate
Python 3.3 adds a timeout parameter to communicate(), so allow it if using
Python 3.
-rw-r--r-- | astroid/brain/py2stdlib.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/astroid/brain/py2stdlib.py b/astroid/brain/py2stdlib.py index c08e54a..206bd8c 100644 --- a/astroid/brain/py2stdlib.py +++ b/astroid/brain/py2stdlib.py @@ -190,6 +190,7 @@ def cleanup_resources(force=False): def subprocess_transform(): if PY3K: communicate = (bytes('string', 'ascii'), bytes('string', 'ascii')) + communicate_signature = 'def communicate(self, input=None, timeout=None)' init = """ def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, @@ -201,6 +202,7 @@ def subprocess_transform(): """ else: communicate = ('string', 'string') + communicate_signature = 'def communicate(self, input=None)' init = """ def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, @@ -228,7 +230,7 @@ def subprocess_transform(): %(init)s - def communicate(self, input=None): + %(communicate_signature)s: return %(communicate)r %(wait_signature)s: return self.returncode @@ -243,6 +245,7 @@ def subprocess_transform(): %(ctx_manager)s ''' % {'init': init, 'communicate': communicate, + 'communicate_signature': communicate_signature, 'wait_signature': wait_signature, 'ctx_manager': ctx_manager}) return AstroidBuilder(MANAGER).string_build(code) |