From 8eb6c7ae7f674b1ffbbbb1a5c16496354faf9293 Mon Sep 17 00:00:00 2001 From: Wulian233 <1055917385@qq.com> Date: Fri, 5 Jul 2024 21:30:28 +0800 Subject: [PATCH 1/5] Rename stackviewer module to stackbrowser. --- Lib/idlelib/News3.txt | 11 +++++++++-- Lib/idlelib/README.txt | 7 +++---- Lib/idlelib/idle_test/htest.py | 2 +- Lib/idlelib/idle_test/test_debugger.py | 6 +++--- .../{test_stackviewer.py => test_stackbrowser.py} | 12 ++++++------ Lib/idlelib/pyshell.py | 2 +- Lib/idlelib/run.py | 4 ++-- Lib/idlelib/{stackviewer.py => stackbrowser.py} | 11 ++++------- .../2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst | 1 + 9 files changed, 30 insertions(+), 26 deletions(-) rename Lib/idlelib/idle_test/{test_stackviewer.py => test_stackbrowser.py} (72%) rename Lib/idlelib/{stackviewer.py => stackbrowser.py} (90%) create mode 100644 Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index b1b652dc562c8ee..b4a535ce3c8c9a8 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -1,9 +1,16 @@ +What's New in IDLE 3.14.0 +(since 3.14.0) +Released on 2025-10-01 +========================= + +gh-112695: Rename stackviewer module to stackbrowser. + + What's New in IDLE 3.13.0 (since 3.12.0) -Released on 2024-10-xx +Released on 2024-10-01 ========================= - gh-78955: Use user-selected color theme for Help => IDLE Doc. gh-96905: In idlelib code, stop redefining built-ins 'dict' and 'object'. diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 76aec58912f00e5..e3d0404b249dcf3 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -77,9 +77,8 @@ searchbase.py # Define base for search, replace, and grep dialogs. searchengine.py # Define engine for all 3 search dialogs. sidebar.py # Define line number and shell prompt sidebars. squeezer.py # Squeeze long shell output (nim). -stackviewer.py # View stack after exception. +stackbrowser.py # View stack after exception. statusbar.py # Define status bar for windows (nim). -tabbedpages.py # Define tabbed pages widget (nim). textview.py # Define read-only text widget (nim). tooltip.py # Define popups for calltips, squeezer (nim). tree.py # Define tree widget, used in browsers (nim). @@ -100,8 +99,8 @@ Text ---- CREDITS.txt # not maintained, displayed by About IDLE HISTORY.txt # NEWS up to July 2001 -NEWS.txt # commits, displayed by About IDLE -NEWS2.txt # commits to Python2 +NEWS3.txt # commits, displayed by About IDLE +NEWS2x.txt # commits to Python2 README.txt # this file, displayed by About IDLE TODO.txt # needs review extend.txt # about writing extensions diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py index a7293774eecaeb9..d373d673da9006d 100644 --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -320,7 +320,7 @@ } _stackbrowser_spec = { - 'file': 'stackviewer', + 'file': 'stackbrowser', 'kwds': {}, 'msg': "A stacktrace for a NameError exception.\n" "Should have NameError and 1 traceback line." diff --git a/Lib/idlelib/idle_test/test_debugger.py b/Lib/idlelib/idle_test/test_debugger.py index d1c9638dd5d711e..baa132e4e4bf293 100644 --- a/Lib/idlelib/idle_test/test_debugger.py +++ b/Lib/idlelib/idle_test/test_debugger.py @@ -241,7 +241,7 @@ def tearDownClass(cls): del cls.root def setUp(self): - self.code = compile(TEST_CODE, 'test_stackviewer.py', 'exec') + self.code = compile(TEST_CODE, 'test_stackbrowser.py', 'exec') self.stack = [ (MockFrame(self.code, 1), 1), (MockFrame(self.code, 2), 2) @@ -272,8 +272,8 @@ def test_show_source(self): # Patch out isfile to pretend file exists. with patch('idlelib.debugger.os.path.isfile', return_value=True) as isfile: self.sv.show_source(1) - isfile.assert_called_once_with('test_stackviewer.py') - self.sv.flist.open.assert_called_once_with('test_stackviewer.py') + isfile.assert_called_once_with('test_stackbrowser.py') + self.sv.flist.open.assert_called_once_with('test_stackbrowser.py') class NameSpaceTest(unittest.TestCase): diff --git a/Lib/idlelib/idle_test/test_stackviewer.py b/Lib/idlelib/idle_test/test_stackbrowser.py similarity index 72% rename from Lib/idlelib/idle_test/test_stackviewer.py rename to Lib/idlelib/idle_test/test_stackbrowser.py index 55f510382bf4c36..b59d6f0f34a8c66 100644 --- a/Lib/idlelib/idle_test/test_stackviewer.py +++ b/Lib/idlelib/idle_test/test_stackbrowser.py @@ -1,6 +1,6 @@ -"Test stackviewer, coverage 63%." +"Test stackbrowser, coverage 63%." -from idlelib import stackviewer +from idlelib import stackbrowser import unittest from test.support import requires from tkinter import Tk @@ -30,11 +30,11 @@ def test_init(self): try: abc except NameError as exc: - sb = stackviewer.StackBrowser(self.root, exc) + sb = stackbrowser.StackBrowser(self.root, exc) isi = self.assertIsInstance - isi(stackviewer.sc, ScrolledCanvas) - isi(stackviewer.item, stackviewer.StackTreeItem) - isi(stackviewer.node, TreeNode) + isi(stackbrowser.sc, ScrolledCanvas) + isi(stackbrowser.item, stackbrowser.StackTreeItem) + isi(stackbrowser.node, TreeNode) if __name__ == '__main__': diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index d8b2652d5d7979c..c654a72e8ac5f63 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -1362,7 +1362,7 @@ def open_stack_viewer(self, event=None): # -n mode only if self.interp.rpcclt: return self.interp.remote_stack_viewer() - from idlelib.stackviewer import StackBrowser + from idlelib.stackbrowser import StackBrowser try: StackBrowser(self.root, sys.last_exc, self.flist) except: diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 8974b52674fb8c8..e4477905b851a43 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -24,7 +24,7 @@ from idlelib import debugobj_r # remote_object_tree_item from idlelib import iomenu # encoding from idlelib import rpc # multiple objects -from idlelib import stackviewer # StackTreeItem +from idlelib import stackbrowser # StackTreeItem import __main__ import tkinter # Use tcl and, if startup fails, messagebox. @@ -639,7 +639,7 @@ def stackviewer(self, flist_oid=None): while tb and tb.tb_frame.f_globals["__name__"] in ["rpc", "run"]: tb = tb.tb_next exc.__traceback__ = tb - item = stackviewer.StackTreeItem(exc, flist) + item = stackbrowser.StackTreeItem(exc, flist) return debugobj_r.remote_object_tree_item(item) diff --git a/Lib/idlelib/stackviewer.py b/Lib/idlelib/stackbrowser.py similarity index 90% rename from Lib/idlelib/stackviewer.py rename to Lib/idlelib/stackbrowser.py index 95042d4debdc03b..4c0cdb9a5144f3e 100644 --- a/Lib/idlelib/stackviewer.py +++ b/Lib/idlelib/stackbrowser.py @@ -1,5 +1,3 @@ -# Rename to stackbrowser or possibly consolidate with browser. - import linecache import os @@ -64,10 +62,9 @@ def GetText(self): sourceline = linecache.getline(filename, lineno) sourceline = sourceline.strip() if funcname in ("?", "", None): - item = "%s, line %d: %s" % (modname, lineno, sourceline) + item = f"{modname}, line {lineno}: {sourceline}" else: - item = "%s.%s(...), line %d: %s" % (modname, funcname, - lineno, sourceline) + item = f"{modname}.{funcname}(...), line {lineno}: {sourceline}" return item def GetSubList(self): @@ -116,7 +113,7 @@ def setfunction(value, key=key, object_=self.object): def _stackbrowser(parent): # htest # from idlelib.pyshell import PyShellFileList top = tk.Toplevel(parent) - top.title("Test StackViewer") + top.title("Test StackBrowser") x, y = map(int, parent.geometry().split('+')[1:]) top.geometry("+%d+%d" % (x + 50, y + 175)) flist = PyShellFileList(top) @@ -128,7 +125,7 @@ def _stackbrowser(parent): # htest # if __name__ == '__main__': from unittest import main - main('idlelib.idle_test.test_stackviewer', verbosity=2, exit=False) + main('idlelib.idle_test.test_stackbrowser', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_stackbrowser) diff --git a/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst b/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst new file mode 100644 index 000000000000000..982132fb8159226 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst @@ -0,0 +1 @@ +Rename stackviewer module to stackbrowser. From 49da66ac47a2b73241ad14090ceb514057bf237f Mon Sep 17 00:00:00 2001 From: Wulian233 <1055917385@qq.com> Date: Sat, 20 Jul 2024 06:45:44 +0800 Subject: [PATCH 2/5] Update News3.txt --- Lib/idlelib/News3.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index e96af065141ce70..48cc8403dc84792 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -3,14 +3,15 @@ What's New in IDLE 3.14.0 Released on 2025-10-01 ========================= -gh-112695: Rename stackviewer module to stackbrowser. - What's New in IDLE 3.13.0 (since 3.12.0) Released on 2024-10-01 ========================= + +gh-112695: Rename stackviewer module to stackbrowser. + gh-78889: Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes, which are all private. From bffef756836bf40473fc03d6d73c347cd37a0ba5 Mon Sep 17 00:00:00 2001 From: Wulian <1055917385@qq.com> Date: Sat, 17 Aug 2024 14:11:03 +0800 Subject: [PATCH 3/5] news --- .../next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst b/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst index 982132fb8159226..ab126bf91306f5a 100644 --- a/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst +++ b/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst @@ -1 +1 @@ -Rename stackviewer module to stackbrowser. +Rename IDLE stackviewer module to stackbrowser. From 1d053b87b3c56a3cfc1efde6d12e51bd88ad6f05 Mon Sep 17 00:00:00 2001 From: Wulian <1055917385@qq.com> Date: Tue, 17 Sep 2024 13:49:20 +0800 Subject: [PATCH 4/5] News3 --- Lib/idlelib/News3.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index 48cc8403dc84792..25bbfe24c6e805a 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -1,12 +1,6 @@ -What's New in IDLE 3.14.0 -(since 3.14.0) -Released on 2025-10-01 -========================= - - What's New in IDLE 3.13.0 (since 3.12.0) -Released on 2024-10-01 +Released on 2024-10-xx ========================= From ac99cdce57095b3484476699780fe875a918df9d Mon Sep 17 00:00:00 2001 From: Wulian <1055917385@qq.com> Date: Tue, 17 Sep 2024 14:05:09 +0800 Subject: [PATCH 5/5] resolve conflict --- Lib/idlelib/News3.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index c66ff125168ca99..b33b7aeb2be7ef3 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -11,7 +11,7 @@ recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles. gh-122482: Change About IDLE to direct users to discuss.python.org -instead of the now unused idle-dev email and mailing list +instead of the now unused idle-dev email and mailing list. gh-78889: Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes, which are all private. @@ -196,8 +196,9 @@ bpo-40181: In calltips, stop reminding that '/' marks the end of positional-only arguments. -What's New in IDLE 3.9.0 (since 3.8.0) -Released on 2020-10-05? +What's New in IDLE 3.9.0 +(since 3.8.0) +Released on 2020-10-05 ====================================== bpo-41468: Improve IDLE run crash error message (which users should