From ffe8598184ff8004de07665fa54a36cf459e24bf Mon Sep 17 00:00:00 2001 From: Ahum Maitra Date: Sat, 23 Aug 2025 23:59:55 +0530 Subject: [PATCH 1/2] Doc: Add exponentiation example to tutorial introduction --- Doc/tutorial/introduction.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index 9e06e03991bc96..b9b848114c3c17 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -63,6 +63,8 @@ For example:: 5.0 >>> 8 / 5 # division always returns a floating-point number 1.6 + >>> 2 ** 9 #2 raised to the power of 9 + 512 The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the ones with a fractional part (e.g. ``5.0``, ``1.6``) have type From 48b4d1de950b187669a2572cb1a003741b9839d8 Mon Sep 17 00:00:00 2001 From: Ahum Maitra Date: Sun, 24 Aug 2025 09:51:18 +0530 Subject: [PATCH 2/2] Lib: Improve IDLE launcher script for clarity and safety --- Doc/tutorial/introduction.rst | 2 -- Lib/idlelib/idle.py | 33 +++++++++++++++++++++++---------- README.rst | 2 +- iOS/testbed/__main__.py | 1 + 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index b9b848114c3c17..9e06e03991bc96 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -63,8 +63,6 @@ For example:: 5.0 >>> 8 / 5 # division always returns a floating-point number 1.6 - >>> 2 ** 9 #2 raised to the power of 9 - 512 The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the ones with a fractional part (e.g. ``5.0``, ``1.6``) have type diff --git a/Lib/idlelib/idle.py b/Lib/idlelib/idle.py index 485d5a75a29c1a..95f0ecb6fb6a98 100644 --- a/Lib/idlelib/idle.py +++ b/Lib/idlelib/idle.py @@ -1,14 +1,27 @@ -import os.path +import os import sys +def add_idlelib_to_path(): + """ + Adds the parent directory of the current file's parent directory + to sys.path to allow running IDLE from a non-standard location. + """ + idlelib_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) + if idlelib_dir not in sys.path: + sys.path.insert(0, idlelib_dir) + return idlelib_dir -# Enable running IDLE with idlelib in a non-standard location. -# This was once used to run development versions of IDLE. -# Because PEP 434 declared idle.py a public interface, -# removal should require deprecation. -idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -if idlelib_dir not in sys.path: - sys.path.insert(0, idlelib_dir) +def main(): + """ + Import and run IDLE's main shell. + """ + add_idlelib_to_path() + try: + from idlelib.pyshell import main as idle_main + except ImportError as e: + print("Could not import idlelib.pyshell:", e) + sys.exit(1) + idle_main() -from idlelib.pyshell import main # This is subject to change -main() +if __name__ == "__main__": + main() diff --git a/README.rst b/README.rst index baea5e0978d8fa..f050e44cb256c2 100644 --- a/README.rst +++ b/README.rst @@ -232,4 +232,4 @@ This Python distribution contains *no* GNU General Public License (GPL) code, so it may be used in proprietary projects. There are interfaces to some GNU code but these are entirely optional. -All trademarks referenced herein are property of their respective holders. \ No newline at end of file +All trademarks referenced herein are property of their respective holders. diff --git a/iOS/testbed/__main__.py b/iOS/testbed/__main__.py index 6a4d9c76d162b4..9862e8d75fe799 100644 --- a/iOS/testbed/__main__.py +++ b/iOS/testbed/__main__.py @@ -99,6 +99,7 @@ def clone_testbed( print(f"{target} already exists; aborting without creating project.") sys.exit(10) + if framework is None: if not ( source / "Python.xcframework/ios-arm64_x86_64-simulator/bin"