https://github.com/python/cpython/commit/d9606d91359bcd3aec1303eb7d721a1b7960a738
commit: d9606d91359bcd3aec1303eb7d721a1b7960a738
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-11-03T14:17:11Z
summary:

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

(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.py
M Lib/test/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.py b/Lib/test/test_os.py
index 99c91ea2ca2dacd..29f15cd622e0f93 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -3863,6 +3863,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_posix.py b/Lib/test/test_posix.py
index 03538a940cb3635..aeaff280c69ef11 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/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 8bd93ff77d6cc44..bae1c6c4005b31a 100644
--- a/Lib/test/test_tkinter/test_misc.py
+++ b/Lib/test/test_tkinter/test_misc.py
@@ -969,6 +969,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 1c2afadd3cb234d..7397f576a61f241 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -2205,7 +2205,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 51d218859d0ecb6..996f5451da059a2 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7915,7 +7915,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;
         }
     }
@@ -11831,7 +11831,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