diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index 37ff93f9866e3c..b33b7aeb2be7ef 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -4,6 +4,8 @@ Released on 2024-10-xx ========================= +gh-112695: Rename stackviewer module to stackbrowser. + gh-120083: Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles. @@ -194,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 diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 76aec58912f00e..e3d0404b249dcf 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 a7293774eecaeb..d373d673da9006 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 d1c9638dd5d711..baa132e4e4bf29 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 55f510382bf4c3..b59d6f0f34a8c6 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 e882c6cb3b8d19..4d1cec7872c7c9 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 8f98e73258e778..50cce68dd5b263 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. @@ -642,7 +642,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 95042d4debdc03..4c0cdb9a5144f3 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 00000000000000..ab126bf91306f5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-07-05-21-25-12.gh-issue-112695.8rT7M4.rst @@ -0,0 +1 @@ +Rename IDLE stackviewer module to stackbrowser.