title: Python TypeError when printing traceback of AttributeError using traceback.print_exc()
body: <p>A reproducible example:</p>
  
  <pre><code>import traceback
  X = None
  try:
      X.text
  except (TypeError, AttributeError) as e:
      traceback.print_exc(e)
  </code></pre>
  
  <p>This will raise an error at <code>traceback.print_exc(e)</code>:</p>
  
  <p><code>TypeError: '&gt;=' not supported between instances of 'AttributeError' and 'int'</code></p>
  
  <p>Any suggestion why this happens?</p>