Author serhiy.storchaka
Recipients Mark.Shannon, gvanrossum, python-dev, serhiy.storchaka, tomkpz
Date 2021-01-15.17:06:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610730376.32.0.211470715338.issue42917@roundup.psfhosted.org>
In-reply-to
Content
Getting rid of hardcoded limits is good. And at first look the proposed PR looks good (some minor details can be discussed).

Although there is different approach to solve the same problem. The stack of blocks is used to set handlers for exceptions. For example, when enter the try block, it pushes the handler that points to except and/or finally clauses, when enter the with block, it pushes the handler that calls __exit__, etc. The stack of handlers is changed at run time, and it was the only solution to this problem. But after reorganizes of bytecode in latest Python versions (mainly by Mark) it is now possible to determine handlers for every instruction statically, at compile time. Instead of stack of blocks we would have a table of addresses of handlers. It is more efficient approach and it is used in modern C++ compilers. The only technical issue is compact and platform-independent representation of the table (because the size of the uncompressed table would be larger than the size of the code, but most of entries are repeated and usually are small integers).

It would make PR 24204 unneeded, so I suggest to wait some time before reviewing it.
History
Date User Action Args
2021-01-15 17:06:16serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, Mark.Shannon, python-dev, tomkpz
2021-01-15 17:06:16serhiy.storchakasetmessageid: <1610730376.32.0.211470715338.issue42917@roundup.psfhosted.org>
2021-01-15 17:06:16serhiy.storchakalinkissue42917 messages
2021-01-15 17:06:15serhiy.storchakacreate