title: Print argument values to functions in stack trace
body: <p>How can we print the values of arguments passed to the functions in the call stack when an error stack trace is printed? I would like the output to be exactly as in the example below.</p>
  
  <p>Example:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./file.py", line 615, in func0 **(arg0) arg0 = 0 was passed**
      result = func1(arg1, arg2)
    File "./file.py", line 728, in func1 **(arg1, arg2) arg1 = 1 and arg2 = 2 was passed**
      return int_value[25]
  TypeError: 'int' object is not iterable
  </code></pre>
  
  <p>I'd like the information inside the ** **s above to also be printed in addition to the normal output in the stack trace. What I envision is that the debugger automatically prints the passed arguments as well. That would give a clear picture of the "functional pipeline" that the data was passed through and what happened to it in the pipeline and which function did not do what it was supposed to do. This would help debugging a lot. </p>
  
  <p>I searched quite a bit and found these related questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/54863123/how-to-print-call-stack-with-argument-values">How to print call stack with argument values?</a></li>
  <li><a href="https://stackoverflow.com/questions/32607286/how-to-print-function-arguments-in-sys-settrace">How to print function arguments in sys.settrace?</a></li>
  </ul>
  
  <p>but the answers to neither of them worked for me: The answer to the 1st one led to <code>ModuleNotFoundError: No module named 'stackdump'</code>. The answer to the 2nd one crashed my <code>ipython</code> interpreter with a very long stack trace.</p>
  
  <p>I also looked up:</p>
  
  <ul>
  <li><a href="https://docs.python.org/3/library/sys.html#sys.settrace" rel="nofollow noreferrer">https://docs.python.org/3/library/sys.html#sys.settrace</a></li>
  <li><a href="https://docs.python.org/3/library/traceback.html" rel="nofollow noreferrer">https://docs.python.org/3/library/traceback.html</a></li>
  </ul>
  
  <p>There seems to be a <code>capture_locals</code> variable for <code>TracebackException</code>s, but I didn't quite understand how to make it work.</p>