From f3592aef055391c95bd6beb7fb38f54b8d9cd4c3 Mon Sep 17 00:00:00 2001 From: RoomWithOutRoof <166608075+Jah-yee@users.noreply.github.com> Date: Thu, 19 Mar 2026 07:20:34 +0800 Subject: [PATCH 1/2] Fix sysconfig.get_platform() for truncated sys.version on Windows On Windows, sysconfig.get_platform() checks for 'amd64' in sys.version to detect 64-bit builds. However, sys.version can be truncated (e.g., ~100 chars on clang builds), causing 'amd64' to be missing and returning 'win32' incorrectly. This fix adds sys.maxsize > 2**32 as a fallback check, which is reliable even when sys.version is truncated. Also reorders arm64 check before arm32 for proper precedence. Fixes: python/cpython#145410 --- Lib/sysconfig/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 8ff9c99435bb1a..1f780bc8f44ec0 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -665,12 +665,17 @@ def get_platform(): For other non-POSIX platforms, currently just returns :data:`sys.platform`.""" if os.name == 'nt': + # Check for architecture in sys.version first, then fall back to sys.maxsize + # which is reliable even when sys.version is truncated (e.g., clang builds on Windows) if 'amd64' in sys.version.lower(): return 'win-amd64' - if '(arm)' in sys.version.lower(): - return 'win-arm32' + if sys.maxsize > 2**32: + # 64-bit Windows where sys.version may be truncated + return 'win-amd64' if '(arm64)' in sys.version.lower(): return 'win-arm64' + if '(arm)' in sys.version.lower(): + return 'win-arm32' return sys.platform if os.name != "posix" or not hasattr(os, 'uname'): From c916f73d063368bfa30be8adb5c864818652eeb9 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Wed, 22 Apr 2026 09:42:16 +0800 Subject: [PATCH 2/2] Fix issue #94466: improve 'help' message in interactive pydoc When typing 'help(help)' inside the interactive help utility (help> prompt), the error message incorrectly suggested 'help()' which would exit the interactive help and return to the interpreter. Since we're already at the help> prompt, the correct command is 'help' (without parentheses) to redisplay the intro. This change updates the error message from: 'Use help() to get the interactive help utility.' to: 'Use 'help' to get the interactive help utility.' This makes the message consistent with the actual behavior - typing 'help' at the help> prompt calls self.intro() as expected. --- Lib/pydoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index a1a6aad434ddf4..e8820755aa3c4d 100644 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1702,7 +1702,7 @@ def resolve(thing, forceload=0): if object is None: raise ImportError('''\ No Python documentation found for %r. -Use help() to get the interactive help utility. +Use 'help' to get the interactive help utility. Use help(str) for help on the str class.''' % thing) return object, thing else: