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 <[email protected]>
<http://bugs.python.org/issue24340>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com