Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Stack trace
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Python === As an example, the following [[Python (programming language)|Python]] program contains an error. <syntaxhighlight lang="python" line="1" highlight="3,9,13,15"> def a(): i = 0 j = b(i) return j def b(z): k = 5 if z == 0: c() return k + z def c(): error() a() </syntaxhighlight> Running the program under the standard Python interpreter produces the following error message. <syntaxhighlight lang="pytb"> Traceback (most recent call last): File "file.py", line 15, in <module> a() File "file.py", line 3, in a j = b(i) File "file.py", line 9, in b c() File "file.py", line 13, in c error() NameError: name 'error' is not defined </syntaxhighlight> The stack trace shows where the error occurs, namely in the <code>c</code> function. It also shows that the <code>c</code> function was called by <code>b</code>, which was called by <code>a</code>, which was in turn called by the code on line 15 (the last line) of the program. The activation records for each of these three functions would be arranged in a stack such that the <code>a</code> function would occupy the bottom of the stack and the <code>c</code> function would occupy the top of the stack.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)