New submission from Thomas Heller:
In a windows debug build, an assertion is triggered when os.execvpe is
called with an empty argument list:
self.assertRaises(OSError, os.execvpe, 'no such app-', [], None)
The same problem is present in the trunk version.
Attached is a patch that fixes this, with a test.
----------
components: Windows
files: os.diff
messages: 55350
nosy: theller
severity: normal
status: open
title: Asssertion in Windows debug build
type: crash
versions: Python 3.0
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1039>
__________________________________
Index: Lib/test/test_os.py
===================================================================
--- Lib/test/test_os.py (revision 57596)
+++ Lib/test/test_os.py (working copy)
@@ -441,6 +441,9 @@
def test_execvpe_with_bad_program(self):
self.assertRaises(OSError, os.execvpe, 'no such app-', [], None)
+ def test_execvpe_with_bad_arglist(self):
+ self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
+
class Win32ErrorTests(unittest.TestCase):
def test_rename(self):
self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak")
Index: Modules/posixmodule.c
===================================================================
--- Modules/posixmodule.c (revision 57596)
+++ Modules/posixmodule.c (working copy)
@@ -2834,6 +2834,11 @@
PyMem_Free(path);
return NULL;
}
+ if (argc < 1) {
+ PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty");
+ PyMem_Free(path);
+ return NULL;
+ }
argvlist = PyMem_NEW(char *, argc+1);
if (argvlist == NULL) {
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com