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.
Created on 2015年05月31日 18:29 by arigo, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1938 | closed | serhiy.storchaka, 2017年06月04日 09:38 | |
| PR 5076 | merged | serhiy.storchaka, 2018年01月01日 20:06 | |
| Messages (8) | |||
|---|---|---|---|
| msg244552 - (view) | Author: Armin Rigo (arigo) * (Python committer) | Date: 2015年05月31日 18:29 | |
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. |
|||
| msg295118 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年06月04日 09:44 | |
PR 1938 tries to balance the stack effect computation for try/except and try/finally. I'm not sure that it is worth backporting. Noised Antoine and Benjamin as people related to issue3021. |
|||
| msg295119 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2017年06月04日 09:45 | |
I'm against backporting performance improvements which don't fix a severe regression. |
|||
| msg295122 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年06月04日 11:06 | |
This isn't so easy. Seems the simplest way to solve this issue is implementing issue17611. |
|||
| msg305677 - (view) | Author: Neil Schemenauer (nascheme) * (Python committer) | Date: 2017年11月06日 21:03 | |
The WIP pull request PR# 2827 seems to help. The following code prints 86 on python3.6 and 25 with PR 2827 applied. def g(): try: pass except ImportError as e: pass try: pass except ImportError as e: pass try: pass except ImportError as e: pass try: pass except ImportError as e: pass try: pass except ImportError as e: pass try: pass except ImportError as e: pass print(g.__code__.co_stacksize) |
|||
| msg309346 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年01月01日 20:08 | |
With PR 5076 the result of the above example is 10. |
|||
| msg309347 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年01月01日 20:10 | |
Tests originally based on Antoine's tests added for PR 2827. |
|||
| msg309733 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年01月09日 19:54 | |
New changeset d4864c61e3e27e337762dc45e504977299bd5b46 by Serhiy Storchaka in branch 'master': bpo-24340: Fix estimation of the code stack size. (#5076) https://github.com/python/cpython/commit/d4864c61e3e27e337762dc45e504977299bd5b46 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:17 | admin | set | github: 68528 |
| 2018年01月11日 19:28:17 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018年01月09日 19:54:55 | serhiy.storchaka | set | messages: + msg309733 |
| 2018年01月03日 18:24:32 | serhiy.storchaka | link | issue31113 dependencies |
| 2018年01月03日 18:19:39 | serhiy.storchaka | link | issue32455 dependencies |
| 2018年01月01日 20:13:02 | serhiy.storchaka | link | issue17611 dependencies |
| 2018年01月01日 20:10:37 | serhiy.storchaka | set | messages: + msg309347 |
| 2018年01月01日 20:08:55 | serhiy.storchaka | set | messages: + msg309346 |
| 2018年01月01日 20:06:58 | serhiy.storchaka | set | keywords:
+ patch pull_requests: + pull_request4950 |
| 2017年11月06日 21:03:15 | nascheme | set | messages: + msg305677 |
| 2017年11月06日 19:51:18 | nascheme | set | nosy:
+ nascheme |
| 2017年08月30日 12:26:52 | serhiy.storchaka | set | pull_requests: - pull_request3289 |
| 2017年08月30日 12:18:41 | serhiy.storchaka | set | pull_requests: + pull_request3289 |
| 2017年06月04日 11:06:19 | serhiy.storchaka | set | messages: + msg295122 |
| 2017年06月04日 09:45:47 | pitrou | set | messages: + msg295119 |
| 2017年06月04日 09:44:13 | serhiy.storchaka | set | versions:
- Python 3.6 nosy: + pitrou, benjamin.peterson messages: + msg295118 stage: needs patch -> patch review |
| 2017年06月04日 09:38:43 | serhiy.storchaka | set | pull_requests: + pull_request2017 |
| 2017年06月04日 06:01:43 | arigo | set | versions: + Python 3.7 |
| 2017年02月21日 09:51:04 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka |
| 2017年02月21日 08:44:58 | methane | set | nosy:
+ methane |
| 2015年06月01日 18:28:51 | arigo | set | nosy:
- arigo |
| 2015年06月01日 17:21:00 | Arfrever | set | nosy:
+ Arfrever |
| 2015年06月01日 07:23:47 | pitrou | set | stage: needs patch type: resource usage versions: + Python 3.6 |
| 2015年05月31日 20:51:18 | yselivanov | set | nosy:
+ yselivanov |
| 2015年05月31日 18:29:54 | arigo | create | |