PDB gehen zu einem Rahmen in Ausnahme in AusnahmePython

Python-Programme
Anonymous
 PDB gehen zu einem Rahmen in Ausnahme in Ausnahme

Post by Anonymous »

Ich debuggiere ein Programm namens A.Py < /code> mit PDB < /p>

Code: Select all

def f(x) :
x / x

def g(x) :
try :
f(x)
except Exception as e :
assert 0

g(0)
< /code>

Wenn ich das Programm mit Python3 -m PDB A.Py < /code> ausführe, wird das Programm unter Assert 0 < /code> Zeile beendet, und ich erhalte die folgenden Fehlerinformationen: < /p>

Traceback (most recent call last):
File "/tmp/a.py", line 6, in g
f(x)
File "/tmp/a.py", line 2, in f
x / x
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib64/python3.6/pdb.py", line 1667, in main
pdb._runscript(mainpyfile)
File "/usr/lib64/python3.6/pdb.py", line 1548, in _runscript
self.run(statement)
File "/usr/lib64/python3.6/bdb.py", line 434, in run
exec(cmd, globals, locals)
File "", line 1, in 
File "/tmp/a.py", line 11, in 
g(0)
File "/tmp/a.py", line 9, in g
assert 0
AssertionError
< /code>

und der Stapel wird (mit BT < /code> Befehl angezeigt): < /p>

gezeigt(Pdb) bt
/usr/lib64/python3.6/pdb.py(1667)main()
-> pdb._runscript(mainpyfile)
/usr/lib64/python3.6/pdb.py(1548)_runscript()
-> self.run(statement)
/usr/lib64/python3.6/bdb.py(434)run()
-> exec(cmd, globals, locals)
(1)()->None
/tmp/a.py(11)()->None
-> g(0)
> /tmp/a.py(9)g()
-> assert 0
(Pdb)
Das Problem ist, dass ich nicht zu Funktion F zum Debuggen von x/x einfach up und down gehen kann, da mein Stapel an der G -Funktion endet. < /p>

Wie soll ich solche Ausnahmen innerhalb von Ausnahmen debuggen? Was ist mit Ausnahmen innerhalb von Ausnahmen innerhalb von Ausnahmen ...?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post