Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # no callstack, we directly crash through to the intepreter
  2. >>> raise ValueError()
  3. Traceback (most recent call last):
  4. File "<input>", line 1, in <module>
  5. ValueError
  6.  
  7. # we raise in a function, we crash to line two, which called the function
  8. >>> def a():
  9. ... raise ValueError()
  10. ...
  11. >>> a()
  12. Traceback (most recent call last):
  13. File "<input>", line 1, in <module>
  14. File "<input>", line 2, in d
  15. ValueError
  16.  
  17. # now the long (but not much more complicated) version, if we crash we just go to the most recent call site
  18. >>> def d():
  19. ... raise ValueError()
  20. ... def c():
  21. ... d()
  22. ... def b():
  23. ... c()
  24. ... def a():
  25. ... b()
  26. ...
  27. >>> a()
  28. Traceback (most recent call last):
  29. File "<input>", line 1, in <module>
  30. File "<input>", line 8, in a
  31. File "<input>", line 6, in b
  32. File "<input>", line 4, in c
  33. File "<input>", line 2, in d
  34. ValueError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement