Message334092
In the documentation of the try statement (https://docs.python.org/3/reference/compound_stmts.html#the-try-statement), I think that the sentence:
"sys.exc_info() values are restored to their previous values (before the call) when returning from a function that handled an exception."
should be replaced by this sentence:
"sys.exc_info() values are restored to their previous values (before the call) when leaving an exception handler."
as proven by this code which does not use any "function that handled an exception" and yet restores sys.exc_info() values:
>>> try:
... raise ValueError
... except:
... try:
... raise TypeError
... except:
... print(sys.exc_info())
... print(sys.exc_info())
...
(<class 'TypeError'>, TypeError(), <traceback object at 0x10ca19bc8>)
(<class 'ValueError'>, ValueError(), <traceback object at 0x10ca19c08>) |
|
Date |
User |
Action |
Args |
2019-01-20 16:39:47 | maggyero | set | recipients:
+ maggyero, ezio.melotti, eric.araujo, docs@python, willingc, mdk |
2019-01-20 16:39:44 | maggyero | set | messageid: <1548002384.27.0.286179066843.issue35790@roundup.psfhosted.org> |
2019-01-20 16:39:44 | maggyero | link | issue35790 messages |
2019-01-20 16:39:44 | maggyero | create | |
|