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

python -m pdb error.py: stuck in unexitable infinite prompt loop #69145

Closed
shlomif mannequin opened this issue Aug 29, 2015 · 3 comments
Closed

python -m pdb error.py: stuck in unexitable infinite prompt loop #69145

shlomif mannequin opened this issue Aug 29, 2015 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@shlomif
Copy link
Mannequin

shlomif mannequin commented Aug 29, 2015

BPO 24957
Nosy @birkenfeld, @terryjreedy, @shlomif
Superseder
  • bpo-16180: cannot quit pdb when there is a syntax error in the debuggee (must kill it)
  • Files
  • euler-234-v1.py
  • 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 2015-09-04.17:50:44.173>
    created_at = <Date 2015-08-29.15:44:54.395>
    labels = ['type-bug', 'library']
    title = 'python -m pdb error.py:  stuck in unexitable infinite prompt loop'
    updated_at = <Date 2015-09-04.17:50:44.172>
    user = 'https://github.com/shlomif'

    bugs.python.org fields:

    activity = <Date 2015-09-04.17:50:44.172>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-09-04.17:50:44.173>
    closer = 'terry.reedy'
    components = ['Library (Lib)']
    creation = <Date 2015-08-29.15:44:54.395>
    creator = 'shlomif'
    dependencies = []
    files = ['40292']
    hgrepos = []
    issue_num = 24957
    keywords = []
    message_count = 3.0
    messages = ['249319', '249320', '249794']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'terry.reedy', 'shlomif']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '16180'
    type = 'behavior'
    url = 'https://bugs.python.org/issue24957'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5', 'Python 3.6']

    @shlomif
    Copy link
    Mannequin Author

    shlomif mannequin commented Aug 29, 2015

    I tried Ctrl+C, Ctrl+D, "quit" and "exit", and "q" - nothing exits from the infinite prompt loop.

    shlomif@telaviv1:~/Docs/homepage/homepage/trunk$ cd /home/shlomif/progs/riddles/project-euler/hg/project-euler/234
    shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/234$ ls
    brute-force.pl   euler-234-description.txt   euler-234-v1.py
    brute-force.pl~  euler-234-description.txt~  euler-234-v1.py~
    shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/234$ python3 euler-234-v1.py 
      File "euler-234-v1.py", line 21
        print "Found[] = ", n
                         ^
    SyntaxError: Missing parentheses in call to 'print'
    shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/234$ python3 -mpdb euler-234-v1.py 1000
    Traceback (most recent call last):
      File "/usr/lib64/python3.4/pdb.py", line 1661, in main
        pdb._runscript(mainpyfile)
      File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
        self.run(statement)
      File "/usr/lib64/python3.4/bdb.py", line 431, in run
        exec(cmd, globals, locals)
      File "<string>", line 1, in <module>
      File "/home/shlomif/progs/riddles/project-euler/hg/project-euler/234/euler-234-v1.py", line 21
        print "Found[] = ", n
                         ^
    SyntaxError: Missing parentheses in call to 'print'
    Uncaught exception. Entering post mortem debugging
    Running 'cont' or 'step' will restart the program
    > <string>(1)<module>()
    (Pdb) 
    (Pdb) exit
    Post mortem debugger finished. The euler-234-v1.py will be restarted
    Traceback (most recent call last):
      File "/usr/lib64/python3.4/pdb.py", line 1661, in main
        pdb._runscript(mainpyfile)
      File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
        self.run(statement)
      File "/usr/lib64/python3.4/bdb.py", line 431, in run
        exec(cmd, globals, locals)
      File "<string>", line 1, in <module>
      File "/home/shlomif/progs/riddles/project-euler/hg/project-euler/234/euler-234-v1.py", line 21                                                                
        print "Found[] = ", n                                                       
                         ^                                                          
    SyntaxError: Missing parentheses in call to 'print'                             
    Uncaught exception. Entering post mortem debugging                              
    Running 'cont' or 'step' will restart the program                               
    > <string>(1)<module>()                                                         
    (Pdb) quit                                                                      
    Post mortem debugger finished. The euler-234-v1.py will be restarted            
    Traceback (most recent call last):                                              
      File "/usr/lib64/python3.4/pdb.py", line 1661, in main                        
        pdb._runscript(mainpyfile)                                                  
      File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript                  
        self.run(statement)                                                         
      File "/usr/lib64/python3.4/bdb.py", line 431, in run                          
        exec(cmd, globals, locals)                                                  
      File "<string>", line 1, in <module>                                          
      File "/home/shlomif/progs/riddles/project-euler/hg/project-euler/234/euler-234-v1.py", line 21
        print "Found[] = ", n
                         ^
    SyntaxError: Missing parentheses in call to 'print'
    Uncaught exception. Entering post mortem debugging
    Running 'cont' or 'step' will restart the program
    > <string>(1)<module>()
    (Pdb) 
    Post mortem debugger finished. The euler-234-v1.py will be restarted
    Traceback (most recent call last):
      File "/usr/lib64/python3.4/pdb.py", line 1661, in main
        pdb._runscript(mainpyfile)
      File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
        self.run(statement)
      File "/usr/lib64/python3.4/bdb.py", line 431, in run
        exec(cmd, globals, locals)
      File "<string>", line 1, in <module>
      File "/home/shlomif/progs/riddles/project-euler/hg/project-euler/234/euler-234-v1.py", line 21
        print "Found[] = ", n
                         ^
    SyntaxError: Missing parentheses in call to 'print'
    Uncaught exception. Entering post mortem debugging
    Running 'cont' or 'step' will restart the program
    > <string>(1)<module>()
    (Pdb) --KeyboardInterrupt--
    (Pdb) --KeyboardInterrupt--
    (Pdb) exit
    Post mortem debugger finished. The euler-234-v1.py will be restarted
    Traceback (most recent call last):
      File "/usr/lib64/python3.4/pdb.py", line 1661, in main
        pdb._runscript(mainpyfile)
      File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
        self.run(statement)
      File "/usr/lib64/python3.4/bdb.py", line 431, in run
        exec(cmd, globals, locals)
      File "<string>", line 1, in <module>
      File "/home/shlomif/progs/riddles/project-euler/hg/project-euler/234/euler-234-v1.py", line 21
        print "Found[] = ", n
                         ^
    SyntaxError: Missing parentheses in call to 'print'
    Uncaught exception. Entering post mortem debugging
    Running 'cont' or 'step' will restart the program
    > <string>(1)<module>()
    (Pdb) quit
    Post mortem debugger finished. The euler-234-v1.py will be restarted
    Traceback (most recent call last):
      File "/usr/lib64/python3.4/pdb.py", line 1661, in main
        pdb._runscript(mainpyfile)
      File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
        self.run(statement)
      File "/usr/lib64/python3.4/bdb.py", line 431, in run
        exec(cmd, globals, locals)
      File "<string>", line 1, in <module>
      File "/home/shlomif/progs/riddles/project-euler/hg/project-euler/234/euler-234-v1.py", line 21
        print "Found[] = ", n
                         ^
    SyntaxError: Missing parentheses in call to 'print'
    Uncaught exception. Entering post mortem debugging
    Running 'cont' or 'step' will restart the program
    > <string>(1)<module>()
    (Pdb) 
    [1]+  Stopped                 python3 -mpdb euler-234-v1.py 1000
    shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/234$ kill %1

    [1]+ Stopped python3 -mpdb euler-234-v1.py 1000
    shlomif@telaviv1:/progs/riddles/project-euler/hg/project-euler/234$
    [1]+ Terminated python3 -mpdb euler-234-v1.py 1000
    shlomif@telaviv1:
    /progs/riddles/project-euler/hg/project-euler/234$
    shlomif@telaviv1:/progs/riddles/project-euler/hg/project-euler/234$
    shlomif@telaviv1:
    /progs/riddles/project-euler/hg/project-euler/234$ jobs
    shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/234$

    @shlomif shlomif mannequin added the stdlib Python modules in the Lib dir label Aug 29, 2015
    @shlomif
    Copy link
    Mannequin Author

    shlomif mannequin commented Aug 29, 2015

    I should note that I am using python3-3.4.3-6.mga6 on Mageia Linux x86-64 6/Cauldron.

    @terryjreedy
    Copy link
    Member

    Pdb says "Running 'cont' or 'step' will restart the program" but it seems to restart on any recognized command other than 'h' and traps everything else. I verified behavior on Win7 with ordinary syntax error 'a = = 1' on installed 2.7.10 and 3.4.3. Removed qualifiers from title.

    Doc says
    '''
    python3 -m pdb myscript.py

    When invoked as a script, pdb will automatically enter post-mortem debugging if the program being debugged exits abnormally. After post-mortem debugging (or after normal exit of the program), pdb will restart the program.'''

    But not being able to exit could not have been the intention. Looking at the code.

    @terryjreedy terryjreedy changed the title python3 -mpdb gets stuck in an unexitable infinite prompt loop when running some Python 2 code with syntax errors python -m pdb error.py: stuck in unexitable infinite prompt loop Sep 4, 2015
    @terryjreedy terryjreedy added the type-bug An unexpected behavior, bug, or error label Sep 4, 2015
    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant