This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author maggyero
Recipients docs@python, eric.araujo, ezio.melotti, maggyero, mdk, willingc
Date 2019-01-20.16:39:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548002384.27.0.286179066843.issue35790@roundup.psfhosted.org>
In-reply-to
Content
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>)
History
Date User Action Args
2019-01-20 16:39:47maggyerosetrecipients: + maggyero, ezio.melotti, eric.araujo, docs@python, willingc, mdk
2019-01-20 16:39:44maggyerosetmessageid: <1548002384.27.0.286179066843.issue35790@roundup.psfhosted.org>
2019-01-20 16:39:44maggyerolinkissue35790 messages
2019-01-20 16:39:44maggyerocreate