https://github.com/python/cpython/commit/4fb00706194e3c5ee5f821d816234b1052e4ced3
commit: 4fb00706194e3c5ee5f821d816234b1052e4ced3
branch: main
author: Thejesh <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-11-02T21:07:29Z
summary:
gh-161179: Fix function names in `os.{spawnve,preadv}()` and
`tkinter.wm_attributes()` error messages (#161180)
files:
A Misc/NEWS.d/next/Library/2026-11-02-13-26-36.gh-issue-161179.H8Yyaw.rst
M Lib/test/test_os/test_os.py
M Lib/test/test_os/test_posix.py
M Lib/test/test_tkinter/test_misc.py
M Lib/tkinter/__init__.py
M Modules/posixmodule.c
diff --git a/Lib/test/test_os/test_os.py b/Lib/test/test_os/test_os.py
index 79aa9e96dc91a6b..662b57702fe26cd 100644
--- a/Lib/test/test_os/test_os.py
+++ b/Lib/test/test_os/test_os.py
@@ -3593,6 +3593,12 @@ def test_spawnve_noargs(self):
self.assertRaises(ValueError, os.spawnve, os.P_NOWAIT, program, ('',),
{})
self.assertRaises(ValueError, os.spawnve, os.P_NOWAIT, program, [''],
{})
+ @requires_native_spawnv
+ def test_spawnve_empty_first_arg_message(self):
+ with self.assertRaisesRegex(ValueError,
+ r'^spawnve\(\) arg 2 first element'):
+ os.spawnve(os.P_NOWAIT, sys.executable, [''], {})
+
@requires_native_spawnv
def test_spawnv_arg_conversion_errors(self):
# A non-path argv item gets a TypeError naming the argument...
diff --git a/Lib/test/test_os/test_posix.py b/Lib/test/test_os/test_posix.py
index 82115c338906fc0..6df1ae8c09ec5f2 100644
--- a/Lib/test/test_os/test_posix.py
+++ b/Lib/test/test_os/test_posix.py
@@ -328,6 +328,8 @@ def test_preadv(self):
buf = [bytearray(i) for i in [5, 3, 2]]
self.assertEqual(posix.preadv(fd, buf, 3), 10)
self.assertEqual([b't1tt2', b't3t', b'5t'], list(buf))
+ with self.assertRaisesRegex(TypeError, r'^preadv\(\) arg 2 '):
+ posix.preadv(fd, 42, 0)
finally:
os.close(fd)
diff --git a/Lib/test/test_tkinter/test_misc.py
b/Lib/test/test_tkinter/test_misc.py
index b32b58ab4340d20..59769b7250d76ac 100644
--- a/Lib/test/test_tkinter/test_misc.py
+++ b/Lib/test/test_tkinter/test_misc.py
@@ -1160,6 +1160,8 @@ def test_wm_attribute(self):
w.wm_attributes(alpha=1.0)
self.assertEqual(w.wm_attributes('alpha'),
1.0 if self.wantobjects else '1.0')
+ with self.assertRaisesRegex(TypeError, r'^wm_attributes\(\) options'):
+ w.wm_attributes('alpha', alpha=0.5)
def test_wm_iconbitmap(self):
t = tkinter.Toplevel(self.root)
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 11bb0ba9c89c4ac..f06807a6cb9c7d7 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -2355,7 +2355,7 @@ def wm_attributes(self, *args, return_python_dict=False,
**kwargs):
# TODO: deprecate
return self.tk.call('wm', 'attributes', self._w, *args)
elif args:
- raise TypeError('wm_attribute() options have been specified as '
+ raise TypeError('wm_attributes() options have been specified as '
'positional and keyword arguments')
else:
self.tk.call('wm', 'attributes', self._w, *self._options(kwargs))
diff --git
a/Misc/NEWS.d/next/Library/2026-11-02-13-26-36.gh-issue-161179.H8Yyaw.rst
b/Misc/NEWS.d/next/Library/2026-11-02-13-26-36.gh-issue-161179.H8Yyaw.rst
new file mode 100644
index 000000000000000..81d12633029959e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-11-02-13-26-36.gh-issue-161179.H8Yyaw.rst
@@ -0,0 +1,2 @@
+Fix the function names in the error messages of :func:`os.spawnve`,
+:func:`os.preadv` and :meth:`tkinter.Wm.wm_attributes`.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2949b3bc34e2637..3999b21efdfc213 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8369,7 +8369,7 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path,
PyObject *argv,
lastarg = i + 1;
PyErr_SetString(
PyExc_ValueError,
- "spawnv() arg 2 first element cannot be empty");
+ "spawnve() arg 2 first element cannot be empty");
goto fail_1;
}
}
@@ -12454,7 +12454,7 @@ os_preadv_impl(PyObject *module, int fd, PyObject
*buffers, Py_off_t offset,
if (!PySequence_Check(buffers)) {
PyErr_SetString(PyExc_TypeError,
- "preadv2() arg 2 must be a sequence");
+ "preadv() arg 2 must be a sequence");
return -1;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]