Issue 33149: Parser stack overflows (original) (raw)

Issue33149

Created on 2018-03-26 23:57 by Isaac Elliott, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg314485 - (view) Author: Isaac Elliott (Isaac Elliott) Date: 2018-03-26 23:57
python3's parser stack overflows on deeply-nested expressions, for example: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] or aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa(aa())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) These are both minimal examples, so if you remove one level of nesting from either then python3 will behave normally.
msg314486 - (view) Author: Isaac Elliott (Isaac Elliott) Date: 2018-03-27 00:20
Because of the way recursive descent parsing works, [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ is actually the minimal input required to reproduce this in python3. In python2, the bug is still present, but requires a slightly deeper nesting: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
msg314497 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2018-03-27 03:31
Duplicate of
History
Date User Action Args
2022-04-11 14:58:59 admin set github: 77330
2018-03-27 14:41:15 ned.deily set status: open -> closedstage: resolved
2018-03-27 03:31:35 pablogsal set resolution: duplicate
2018-03-27 03:31:28 pablogsal set nosy: + pablogsalmessages: +
2018-03-27 03:30:58 pablogsal set superseder: s_push: parser stack overflow MemoryError
2018-03-27 00:20:40 Isaac Elliott set messages: +
2018-03-26 23:57:23 Isaac Elliott create