[Python-3000-checkins] r55754 - in python/branches/p3yk/Lib: os.py test/test_os.py
neal.norwitz
python-3000-checkins at python.org
Mon Jun 4 08:24:23 CEST 2007
Author: neal.norwitz
Date: Mon Jun 4 08:24:18 2007
New Revision: 55754
Modified:
python/branches/p3yk/Lib/os.py
python/branches/p3yk/Lib/test/test_os.py
Log:
SF #1730441, os._execvpe raises UnboundLocal due to new try/except semantics
Modified: python/branches/p3yk/Lib/os.py
==============================================================================
--- python/branches/p3yk/Lib/os.py (original)
+++ python/branches/p3yk/Lib/os.py Mon Jun 4 08:24:18 2007
@@ -388,13 +388,14 @@
else:
envpath = defpath
PATH = envpath.split(pathsep)
- saved_exc = None
+ last_exc = saved_exc = None
saved_tb = None
for dir in PATH:
fullname = path.join(dir, file)
try:
func(fullname, *argrest)
except error as e:
+ last_exc = e
tb = sys.exc_info()[2]
if (e.errno != ENOENT and e.errno != ENOTDIR
and saved_exc is None):
@@ -402,7 +403,7 @@
saved_tb = tb
if saved_exc:
raise error, saved_exc, saved_tb
- raise error, e, tb
+ raise error, last_exc, tb
# Change environ to automatically call putenv() if it exists
try:
Modified: python/branches/p3yk/Lib/test/test_os.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_os.py (original)
+++ python/branches/p3yk/Lib/test/test_os.py Mon Jun 4 08:24:18 2007
@@ -433,6 +433,10 @@
except NotImplementedError:
pass
+class ExecTests(unittest.TestCase):
+ def test_execvpe_with_bad_program(self):
+ self.assertRaises(OSError, os.execvpe, 'no such app-', [], None)
+
class Win32ErrorTests(unittest.TestCase):
def test_rename(self):
self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak")
@@ -469,6 +473,7 @@
MakedirTests,
DevNullTests,
URandomTests,
+ ExecTests,
Win32ErrorTests
)
More information about the Python-3000-checkins
mailing list