New submission from Ivan Pozdeev <ivan_pozd...@mail.ru>:

pdb.Pdb.checkline() throws AttributeError at pdb.py:470 if invoked before 
starting a debugging session because self.curframe doesn't exist at that time.

This breaks IPython's %run magic command (v0.10, Magic.py:1663). The command 
sets a breakpoint before running the script and scans the file before that to 
make sure the breakpoint is set on an executable line. 

This is a reasonable thing to do: setting a breakpoint and making sure it is 
set correctly shouldn't require a running debug session. So i conclude it is 
pdb, not IPython, that shall be fixed.

The patch attached gives linecache.getline() None as module_globals if 
self.curframe doesn't exist.

The rationale is: even if the script does use PEP302 import stuff, we can't 
know or use that before running it. So it's ok if we stay limited with usual 
paths.

----------
components: Library (Lib)
files: pdb_checkline.patch
keywords: patch
messages: 110065
nosy: __Vano
priority: normal
severity: normal
status: open
title: pdb.Pdb.checkline() throws AttributeError if called before starting a 
debug session
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file17955/pdb_checkline.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9230>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to