1

In this code the exception that is raised is the one described by the tuple exc_info returns.

from sys import exc_info
a, b, c = exc_info()
raise a, b, c

In the next code the exception that is raised is a new one and not the one from exc_info

from sys import exc_info
raise exc_info()

The difference is only the unpacking of the tuple, why is sending "a, b, c" not a tuple? (as it usually would be) What's going on here?

Using 2.7

Eran
  • 2,054
  • 3
  • 22
  • 27

1 Answers1

1

That's because raise a,b,traceback means raise a(b) using traceback's line numbers in Python 2. See this question and the raise statement documentation. raise (a,b,c) is different; it raises a tuple consisting of a, b, and c.

Community
  • 1
  • 1
Ramchandra Apte
  • 3,835
  • 2
  • 22
  • 39