[New-bugs-announce] [issue24340] co_stacksize estimate can be highly off
Armin Rigo
report at bugs.python.org
Sun May 31 20:29:54 CEST 2015
New submission from Armin Rigo:
The computation of `co_stacksize' by the compiler is known to give only an upper bound estimate. http://bugs.python.org/issue1754094 is an example of fixing a "leak" where every repetition of a statement makes `co_stacksize' bigger by 1. However, in the whole 3.x series (from at least 3.2), the following simple code, which at runtime requires about 4 or 5 stack slots, leaks 14(!) slots for every `try:' block. Maybe this should be improved to reduce the extreme size of the leak.
def g():
try: pass
except ImportError as e: pass
try: pass
except ImportError as e: pass
try: pass
except ImportError as e: pass
...
i.e. any function that is big enough to contain 6 try: blocks in sequence will have its stack size overestimated by about 70.
----------
components: Interpreter Core
messages: 244552
nosy: arigo
priority: normal
severity: normal
status: open
title: co_stacksize estimate can be highly off
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24340>
_______________________________________
More information about the New-bugs-announce
mailing list