From addad402fc0f2e623023a9a2f2d66adaff3861fc Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google]" Date: Mon, 21 May 2018 11:39:08 -0700 Subject: [PATCH] Remove the signal.Signals reference (not in 2.7). Constructing a CalledProcessError when the process died due to a signal could raise an AttributeError due to this bug. github issue #49. --- ChangeLog | 6 ++++++ setup.py | 2 +- subprocess32.py | 8 ++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7eb248d..66bae1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +----------------- +2018-05-21 3.5.1 +----------------- +* Fix AttributeError: 'module' object has no attribute 'Signals' when + constructing a CalledProcessError exception. [#49] + ----------------- 2018-05-13 3.5.0 (3.5.0rc3) ----------------- diff --git a/setup.py b/setup.py index 762f17b..345d00c 100755 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ def main(): setup( name='subprocess32', - version='3.5.0', + version='3.5.1', description='A backport of the subprocess module from Python 3 for use on 2.x.', long_description="""\ This is a backport of the subprocess standard library module from diff --git a/subprocess32.py b/subprocess32.py index ff4976d..b5c6a55 100644 --- a/subprocess32.py +++ b/subprocess32.py @@ -67,12 +67,8 @@ def __init__(self, returncode, cmd, output=None, stderr=None): def __str__(self): if self.returncode and self.returncode < 0: - try: - return "Command '%s' died with %r." % ( - self.cmd, signal.Signals(-self.returncode)) - except ValueError: - return "Command '%s' died with unknown signal %d." % ( - self.cmd, -self.returncode) + return "Command '%s' died with signal %d." % ( + self.cmd, -self.returncode) else: return "Command '%s' returned non-zero exit status %d." % ( self.cmd, self.returncode)