https://github.com/python/cpython/commit/a2e23910b4724c8d8d69a2a4ee5a8c63f907898b
commit: a2e23910b4724c8d8d69a2a4ee5a8c63f907898b
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-11-02T21:45:28Z
summary:

[3.15] gh-161179: Fix function names in `os.{spawnve,preadv}()` and 
`tkinter.wm_attributes()` error messages (GH-161180) (#161210)

(cherry picked from commit 4fb00706194e3c5ee5f821d816234b1052e4ced3)

Co-authored-by: Thejesh <[email protected]>

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 a5036b556aa4a50..42d6f57c2654d87 100644
--- a/Lib/test/test_os/test_os.py
+++ b/Lib/test/test_os/test_os.py
@@ -3543,6 +3543,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 d439eda330bf6cf..6ac9ed89c8e621c 100644
--- a/Lib/test/test_os/test_posix.py
+++ b/Lib/test/test_os/test_posix.py
@@ -320,6 +320,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 ba5225c3a9b04e8..30947262d56f4fc 100644
--- a/Lib/test/test_tkinter/test_misc.py
+++ b/Lib/test/test_tkinter/test_misc.py
@@ -1002,6 +1002,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 63b08b3e82d4dad..1144a12e2cf7910 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -2276,7 +2276,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 6a13e43dafe9b71..611edf9286e9649 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8397,7 +8397,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;
         }
     }
@@ -12337,7 +12337,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]

Reply via email to