closes bpo-32490: Fix filename duplication in subprocess exception message. (GH-9163)
8621bb5d93
sets the filename in directly in the FileNotFoundError, so we may revert the earlier fix5f78040057
.
This commit is contained in:
parent
3102e24d83
commit
73870bfeb9
|
@ -1512,8 +1512,6 @@ class Popen(object):
|
||||||
err_filename = orig_executable
|
err_filename = orig_executable
|
||||||
if errno_num != 0:
|
if errno_num != 0:
|
||||||
err_msg = os.strerror(errno_num)
|
err_msg = os.strerror(errno_num)
|
||||||
if errno_num == errno.ENOENT:
|
|
||||||
err_msg += ': ' + repr(err_filename)
|
|
||||||
raise child_exception_type(errno_num, err_msg, err_filename)
|
raise child_exception_type(errno_num, err_msg, err_filename)
|
||||||
raise child_exception_type(err_msg)
|
raise child_exception_type(err_msg)
|
||||||
|
|
||||||
|
|
|
@ -1520,7 +1520,6 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
# string and instead capture the exception that we want to see
|
# string and instead capture the exception that we want to see
|
||||||
# below for comparison.
|
# below for comparison.
|
||||||
desired_exception = e
|
desired_exception = e
|
||||||
desired_exception.strerror += ': ' + repr(self._nonexistent_dir)
|
|
||||||
else:
|
else:
|
||||||
self.fail("chdir to nonexistent directory %s succeeded." %
|
self.fail("chdir to nonexistent directory %s succeeded." %
|
||||||
self._nonexistent_dir)
|
self._nonexistent_dir)
|
||||||
|
@ -1537,6 +1536,7 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
# it up to the parent process as the correct exception.
|
# it up to the parent process as the correct exception.
|
||||||
self.assertEqual(desired_exception.errno, e.errno)
|
self.assertEqual(desired_exception.errno, e.errno)
|
||||||
self.assertEqual(desired_exception.strerror, e.strerror)
|
self.assertEqual(desired_exception.strerror, e.strerror)
|
||||||
|
self.assertEqual(desired_exception.filename, e.filename)
|
||||||
else:
|
else:
|
||||||
self.fail("Expected OSError: %s" % desired_exception)
|
self.fail("Expected OSError: %s" % desired_exception)
|
||||||
|
|
||||||
|
@ -1551,6 +1551,7 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
# it up to the parent process as the correct exception.
|
# it up to the parent process as the correct exception.
|
||||||
self.assertEqual(desired_exception.errno, e.errno)
|
self.assertEqual(desired_exception.errno, e.errno)
|
||||||
self.assertEqual(desired_exception.strerror, e.strerror)
|
self.assertEqual(desired_exception.strerror, e.strerror)
|
||||||
|
self.assertEqual(desired_exception.filename, e.filename)
|
||||||
else:
|
else:
|
||||||
self.fail("Expected OSError: %s" % desired_exception)
|
self.fail("Expected OSError: %s" % desired_exception)
|
||||||
|
|
||||||
|
@ -1564,6 +1565,7 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
# it up to the parent process as the correct exception.
|
# it up to the parent process as the correct exception.
|
||||||
self.assertEqual(desired_exception.errno, e.errno)
|
self.assertEqual(desired_exception.errno, e.errno)
|
||||||
self.assertEqual(desired_exception.strerror, e.strerror)
|
self.assertEqual(desired_exception.strerror, e.strerror)
|
||||||
|
self.assertEqual(desired_exception.filename, e.filename)
|
||||||
else:
|
else:
|
||||||
self.fail("Expected OSError: %s" % desired_exception)
|
self.fail("Expected OSError: %s" % desired_exception)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Prevent filename duplication in :mod:`subprocess` exception messages. Patch
|
||||||
|
by Zackery Spytz.
|
Loading…
Reference in New Issue