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 Mark.Shannon
Recipients Mark.Shannon
Date 2020-04-08.09:41:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
C++ and Java support what is known as "zero cost" exception handling.
The "zero cost" refers to the cost when no exception is raised. There is still a cost when exceptions are thrown.

The basic principle is that the compiler generates tables indicating where control should be transferred to when an exception is raised. When no exception is raised, there is no runtime overhead.

(C)Python should support "zero cost" exceptions.

Now that the bytecodes for exception handling are regular (meaning that their stack effect can be statically determined) it is possible for the bytecode compiler to emit exception handling tables.

Doing so would have two main benefits.
1. "try" and "with" statements would be faster (and "async for", but that is an implementation detail).
2. Calls to Python functions would be faster as frame objects would be considerably smaller. Currently each frame carries 240 bytes of overhead for exception handling.
Date User Action Args
2020-04-08 09:41:03Mark.Shannonsetrecipients: + Mark.Shannon
2020-04-08 09:41:03Mark.Shannonsetmessageid: <>
2020-04-08 09:41:03Mark.Shannonlinkissue40222 messages
2020-04-08 09:41:02Mark.Shannoncreate