~/.pdbrc:
Код: Выделить всё
!import pdbext.debug
alias pl !pdbext.debug.debug_print (locals ())
Код: Выделить всё
def debug_print (d):
print ("debug_print() d = ",d, flush = True)
return
Код: Выделить всё
import test2
def test1 ():
i = 0
print ("test1 ()", flush = True)
test2.test3 ()
return
test1 ()
Код: Выделить всё
def test3 ():
a = 4
print ("test3 ()", flush = True)
return
Код: Выделить всё
python3 -m pdb test.py
(Pdb) b 6
(Pdb) continue
(Pdb) pl
shows: debug_print() d = {'i': 0}
(Pdb) step
(Pdb) step (this puts pdb in test2.test3())
(Pdb) pl
shows: *** NameError: name 'pdbext' is not defined
Заранее спасибо
Подробнее здесь: https://stackoverflow.com/questions/798 ... y-in-scope
Мобильная версия