Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE crashes on *File / Path browser* #60430

Closed
fgracia mannequin opened this issue Oct 14, 2012 · 8 comments
Closed

IDLE crashes on *File / Path browser* #60430

fgracia mannequin opened this issue Oct 14, 2012 · 8 comments
Labels
topic-IDLE type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@fgracia
Copy link
Mannequin

fgracia mannequin commented Oct 14, 2012

BPO 16226
Nosy @terryjreedy, @ned-deily, @serwy
Files
  • issue16226.patch
  • issue16226_test.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-10-19.01:31:04.262>
    created_at = <Date 2012-10-14.09:17:59.470>
    labels = ['expert-IDLE', 'type-crash']
    title = 'IDLE crashes on *File / Path browser*'
    updated_at = <Date 2014-02-27.16:05:40.044>
    user = 'https://bugs.python.org/fgracia'

    bugs.python.org fields:

    activity = <Date 2014-02-27.16:05:40.044>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-10-19.01:31:04.262>
    closer = 'ned.deily'
    components = ['IDLE']
    creation = <Date 2012-10-14.09:17:59.470>
    creator = 'fgracia'
    dependencies = []
    files = ['27577', '27613']
    hgrepos = []
    issue_num = 16226
    keywords = ['patch', '3.3regression']
    message_count = 8.0
    messages = ['172863', '172893', '172936', '173302', '173303', '190382', '212341', '212362']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'ned.deily', 'roger.serwy', 'python-dev', 'fgracia', 'Saimadhav.Heblikar']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue16226'
    versions = ['Python 3.3', 'Python 3.4']

    @fgracia
    Copy link
    Mannequin Author

    fgracia mannequin commented Oct 14, 2012

    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.

    Regards

    @fgracia fgracia mannequin added topic-IDLE type-crash A hard crash of the interpreter, possibly with a core dump labels Oct 14, 2012
    @ned-deily
    Copy link
    Member

    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/__init__.py", line 1442, in __call__
        return self.func(*args)
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py", line 131, in expand
        self.update()
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py", line 164, in update
        self.parent.update()
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py", line 170, in update
        self.draw(7, 2)
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py", line 197, in draw
        cy = child.draw(cx, cy)
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py", line 184, in draw
        sublist = self.item._GetSubList()
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/TreeWidget.py", line 338, in _GetSubList
        sublist = self.GetSubList()
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PathBrowser.py", line 61, in GetSubList
        for nn, name in self.listmodules(names):
      File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PathBrowser.py", line 78, in listmodules
        for suff, mode, flag in suffixes:
    ValueError: too many values to unpack (expected 3)

    @serwy
    Copy link
    Mannequin

    serwy mannequin commented Oct 15, 2012

    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 bpo-15392.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 19, 2012

    New changeset d369e50677a6 by Ned Deily in branch '3.3':
    Issue bpo-16226: Fix IDLE Path Browser crash.
    http://hg.python.org/cpython/rev/d369e50677a6

    New changeset 58f9523cf407 by Ned Deily in branch 'default':
    Issue bpo-16226: Fix IDLE Path Browser crash.
    http://hg.python.org/cpython/rev/58f9523cf407

    @ned-deily
    Copy link
    Member

    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 bpo-15392. I'm attaching the test as a separate patch and will add a comment to 15392 that the test should be added.

    @terryjreedy
    Copy link
    Member

    Test has been committed on all three branches as part of bpo-15392

    @SaimadhavHeblikar
    Copy link
    Mannequin

    SaimadhavHeblikar mannequin commented Feb 27, 2014

    This patch does
    1.Remove PEP-8 violations in PathBrowser.py . Replaces "file","dir","sorted" by "file_","dir_","sorted_" respectively.
    2.Extends test coverage for PathBrowser.py in idle_test/test_PathBrowser.py

    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 itself.it is indirectly being tested from lines 8 and 9(in the current tip).

    @terryjreedy
    Copy link
    Member

    S.H. moved his patch for new tests to new issue bpo-20792.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants