Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Lib/idlelib/News3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions Lib/idlelib/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/idle_test/htest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
6 changes: 3 additions & 3 deletions Lib/idlelib/idle_test/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__':
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)


Expand Down
11 changes: 4 additions & 7 deletions Lib/idlelib/stackviewer.py → Lib/idlelib/stackbrowser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Rename to stackbrowser or possibly consolidate with browser.

import linecache
import os

Expand Down Expand Up @@ -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}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change in renamed files: I think it's clearer to use f-string here

return item

def GetSubList(self):
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename IDLE stackviewer module to stackbrowser.
Loading