This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: IDLE crashes on *File / Path browser*
Type: crash Stage: resolved
Components: IDLE Versions: Python 3.3, Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Saimadhav.Heblikar, fgracia, ned.deily, python-dev, roger.serwy, terry.reedy
Priority: high Keywords: 3.3regression, patch

Created on 2012-10-14 09:17 by fgracia, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue16226.patch roger.serwy, 2012-10-15 01:25 review
issue16226_test.patch ned.deily, 2012-10-19 01:31 review
Messages (8)
msg172863 - (view) Author: Francisco Gracia (fgracia) Date: 2012-10-14 09:17
The menu option *File / Path browser* (as well in the *Shell* window as in the *Editor* one) shows a new window with a tree structure rooted at *sys.path*. The available leaf nodes show the *plus* sign that usually implies that they can be expanded by clicking on the desired one. On the performance of this action IDLE disappears immediately. If one clicks just on the legend of the node, IDLE remains undisturbed but nothing more happens.

Idle's help says:

*File Menu:
Path Browser -- Show sys.path directories, modules, classes and methods*

so that apparently the expansion should also work.

I suppose that this command would be mostly used at the initial phases of learning Python (at least I would have done it if I had noticed then its existence and function), but its present status does not favor such didactic purpose.

msg172893 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-10-14 17:18
Thank you for the report.  There does seem to be a regression in the 3.3 version of IDLE.  Using the OS X version of bin/idle3.3 and selecting menu item File -> Path Browser results in the following exception:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tkinter/", line 1442, in __call__
    return self.func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 131, in expand
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 164, in update
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 170, in update
    self.draw(7, 2)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 197, in draw
    cy = child.draw(cx, cy)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 184, in draw
    sublist = self.item._GetSubList()
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 338, in _GetSubList
    sublist = self.GetSubList()
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 61, in GetSubList
    for nn, name in self.listmodules(names):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/", line 78, in listmodules
    for suff, mode, flag in suffixes:
ValueError: too many values to unpack (expected 3)
msg172936 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-10-15 01:25
Here's the revision that broke it: b81ddaf0db47

The 2.7 branch still uses imp.get_suffixes, whereas the 3.3 and 3.4 uses this importlib construct.

The imp.get_suffixes returns a list of tuples of 3 items: (suffix, mode, type). The current code only returns what would be the first item of that tuple. The for-loop only uses that first item anyway, so the tuple unpacking can be removed safely.

The attached patch fixes the issue. It also includes a basic unit test within the idlelib/test directory. We need to get the unittest framework started for IDLE, as given in issue15392.
msg173302 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-19 01:19
New changeset d369e50677a6 by Ned Deily in branch '3.3':
Issue #16226: Fix IDLE Path Browser crash.

New changeset 58f9523cf407 by Ned Deily in branch 'default':
Issue #16226: Fix IDLE Path Browser crash.
msg173303 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-10-19 01:31
I've committed Roger's fix for release in 3.3.1 and 3.4.0.  Thanks, Roger.  I did not apply the proposed test since, as it stands, it would never be run by test.regrtest without establishing a idlelib test runner infrastructure as proposed by Issue15392.  I'm attaching the test as a separate patch and will add a comment to 15392 that the test should be added.
msg190382 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-05-30 21:08
Test has been committed on all three branches as part of #15392
msg212341 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-02-27 09:15
This patch does 
1.Remove pep8 violations in . Replaces "file","dir","sorted" by "file_","dir_","sorted_" respectively.
2.Extends test coverage for in idle_test/

New modules now under tests include
1.dirBrowserTreeItem - getText,ispackagedir
2.pathBrowserTreeItem - getText,getSublist

Only method missing a test after this patch will be listmodules.I am not too sure whether it requires a test for is indirectly being tested from lines 8 and 9(in the current tip).
msg212362 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-27 16:05
S.H. moved his patch for new tests to new issue #20792.
Date User Action Args
2022-04-11 14:57:37adminsetgithub: 60430
2014-02-27 16:05:40terry.reedysetmessages: + msg212362
2014-02-27 09:27:51Saimadhav.Heblikarsetfiles: - pathbrowser1.patch
2014-02-27 09:15:34Saimadhav.Heblikarsetfiles: + pathbrowser1.patch
nosy: + Saimadhav.Heblikar
messages: + msg212341

2013-05-30 21:08:44terry.reedysetnosy: + terry.reedy
messages: + msg190382
2012-10-19 01:31:04ned.deilysetstatus: open -> closed
files: + issue16226_test.patch
messages: + msg173303

resolution: fixed
stage: needs patch -> resolved
2012-10-19 01:19:55python-devsetnosy: + python-dev
messages: + msg173302
2012-10-15 01:25:38roger.serwysetfiles: + issue16226.patch

nosy: + roger.serwy
messages: + msg172936

keywords: + patch
2012-10-14 17:18:13ned.deilysetpriority: normal -> high

versions: + Python 3.4
keywords: + 3.3regression
nosy: + ned.deily

messages: + msg172893
stage: needs patch
2012-10-14 09:17:59fgraciacreate