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

Interpreter error when running a script under debugger control #47665

Closed
nirai mannequin opened this issue Jul 19, 2008 · 3 comments
Closed

Interpreter error when running a script under debugger control #47665

nirai mannequin opened this issue Jul 19, 2008 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@nirai
Copy link
Mannequin

nirai mannequin commented Jul 19, 2008

BPO 3415
Nosy @birkenfeld, @amauryfa
Superseder
  • bpo-2378: UnboundLocalError when trying to raise exceptions inside execfile
  • 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 2008-07-21.09:29:43.518>
    created_at = <Date 2008-07-19.05:32:34.369>
    labels = ['interpreter-core', 'type-bug']
    title = 'Interpreter error when running a script under debugger control'
    updated_at = <Date 2008-07-21.09:29:43.456>
    user = 'https://bugs.python.org/nirai'

    bugs.python.org fields:

    activity = <Date 2008-07-21.09:29:43.456>
    actor = 'amaury.forgeotdarc'
    assignee = 'jhylton'
    closed = True
    closed_date = <Date 2008-07-21.09:29:43.518>
    closer = 'amaury.forgeotdarc'
    components = ['Interpreter Core']
    creation = <Date 2008-07-19.05:32:34.369>
    creator = 'nirai'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 3415
    keywords = []
    message_count = 3.0
    messages = ['70005', '70013', '70099']
    nosy_count = 4.0
    nosy_names = ['jhylton', 'georg.brandl', 'amaury.forgeotdarc', 'nirai']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '2378'
    type = 'behavior'
    url = 'https://bugs.python.org/issue3415'
    versions = ['Python 2.6', 'Python 3.0']

    @nirai
    Copy link
    Mannequin Author

    nirai mannequin commented Jul 19, 2008

    Interpreter error results in erroneous exception when running a script
    under debugger control.

    Full repro description:
    On Windows System, try to run idle.py under the inspection of pdb.py.
    Note that you must set a breakpoint somewhere otherwise pdb will not
    trace the script and the issue will not surface.

    You should get the bad exception in line 295 of multicall.py

    Python complains that a local variable has been used before being
    declared while in effect it has been a couple of lines before that point.

    Nir

    @nirai nirai mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Jul 19, 2008
    @birkenfeld
    Copy link
    Member

    For reference, here is the output of the pdb session:

    gbr@lap ~/devel/python> ./python Lib/pdb.py Lib/idlelib/idle.py
    > /home/gbr/devel/python/Lib/idlelib/idle.py(1)<module>()
    -> try:
    (Pdb) break multicall.py:300
    ***  'multicall.py' not found from sys.path
    (Pdb) break idle.py:10
    Breakpoint 1 at /home/gbr/devel/python/Lib/idlelib/idle.py:10
    (Pdb) c
    Traceback (most recent call last):
      File "/home/gbr/devel/python/Lib/pdb.py", line 1275, in main
        pdb._runscript(mainpyfile)
      File "/home/gbr/devel/python/Lib/pdb.py", line 1192, in _runscript
        self.run(statement)
      File "/home/gbr/devel/python/Lib/bdb.py", line 366, in run
        exec cmd in globals, locals
      File "<string>", line 1, in <module>
      File "Lib/idlelib/idle.py", line 21, in <module>
        idlelib.PyShell.main()
      File "/home/gbr/devel/python/Lib/idlelib/PyShell.py", line 1396, in main
        shell = flist.open_shell()
      File "/home/gbr/devel/python/Lib/idlelib/PyShell.py", line 275, in
    open_shell
        self.pyshell = PyShell(self)
      File "/home/gbr/devel/python/Lib/idlelib/PyShell.py", line 816, in
    __init__
        OutputWindow.__init__(self, flist, None, None)
      File "/home/gbr/devel/python/Lib/idlelib/OutputWindow.py", line 16, in
    __init__
        EditorWindow.__init__(self, *args)
      File "/home/gbr/devel/python/Lib/idlelib/EditorWindow.py", line 108,
    in __init__
        self.text = text = MultiCallCreator(Text)(
      File "/home/gbr/devel/python/Lib/idlelib/MultiCall.py", line 294, in
    MultiCallCreator
        class MultiCall (widget):
      File "/home/gbr/devel/python/Lib/idlelib/MultiCall.py", line 295, in
    MultiCall
        assert issubclass(widget, Tkinter.Misc)
    NameError: free variable 'widget' referenced before assignment in
    enclosing scope
    Uncaught exception. Entering post mortem debugging
    Running 'cont' or 'step' will restart the program
    > /home/gbr/devel/python/Lib/idlelib/MultiCall.py(295)MultiCall()
    -> assert issubclass(widget, Tkinter.Misc)
    (Pdb) 

    I *think* we had some similar issue with trace functions and class
    scopes in the past, but can't remember where.

    @amauryfa
    Copy link
    Member

    This issue is a duplicate of bpo-2378; the patch attached there
    corrects this problem. I will commit it tonight.

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants