https://github.com/python/cpython/commit/c358b89d240cb193c007e38f9f643b2a3d9f5de6
commit: c358b89d240cb193c007e38f9f643b2a3d9f5de6
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-04-07T03:35:14Z
summary:

[3.13] gh-137586: Open external osascript program with absolute path 
(GH-137584) (#148174)

Co-authored-by: Fionn <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>

files:
A Misc/NEWS.d/next/macOS/2025-10-17-01-07-03.gh-issue-137586.kVzxvp.rst
M Lib/test/test_webbrowser.py
M Lib/turtledemo/__main__.py
M Lib/webbrowser.py

diff --git a/Lib/test/test_webbrowser.py b/Lib/test/test_webbrowser.py
index 3b3b0ae8c77745..e8b8b020deadb1 100644
--- a/Lib/test/test_webbrowser.py
+++ b/Lib/test/test_webbrowser.py
@@ -350,7 +350,7 @@ def test_default_open(self):
         url = "https://python.org";
         self.browser.open(url)
         self.assertTrue(self.popen_pipe._closed)
-        self.assertEqual(self.popen_pipe.cmd, "osascript")
+        self.assertEqual(self.popen_pipe.cmd, "/usr/bin/osascript")
         script = self.popen_pipe.pipe.getvalue()
         self.assertEqual(script.strip(), f'open location "{url}"')
 
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
index 8dbda474bb3efd..967ccb0f15308a 100755
--- a/Lib/turtledemo/__main__.py
+++ b/Lib/turtledemo/__main__.py
@@ -138,7 +138,7 @@ def __init__(self, filename=None):
             # so that our menu bar appears.
             subprocess.run(
                     [
-                        'osascript',
+                        '/usr/bin/osascript',
                         '-e', 'tell application "System Events"',
                         '-e', 'set frontmost of the first process whose '
                               'unix id is {} to true'.format(os.getpid()),
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index dc8359dd1a4566..ee5824100c7b9a 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -619,7 +619,7 @@ def open(self, url, new=0, autoraise=True):
                    end
                    '''
 
-            osapipe = os.popen("osascript", "w")
+            osapipe = os.popen("/usr/bin/osascript", "w")
             if osapipe is None:
                 return False
 
diff --git 
a/Misc/NEWS.d/next/macOS/2025-10-17-01-07-03.gh-issue-137586.kVzxvp.rst 
b/Misc/NEWS.d/next/macOS/2025-10-17-01-07-03.gh-issue-137586.kVzxvp.rst
new file mode 100644
index 00000000000000..8e42065392a2de
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2025-10-17-01-07-03.gh-issue-137586.kVzxvp.rst
@@ -0,0 +1 @@
+Invoke :program:`osascript` with absolute path in :mod:`webbrowser` and 
:mod:`!turtledemo`.

_______________________________________________
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