LibCST icon indicating copy to clipboard operation
LibCST copied to clipboard

Stack overflow when parsing an expression

Open orf opened this issue 1 year ago • 3 comments

Below I've attached a real file that has been published on PyPI. It contains an impressively gigantic expression.

huge.txt

Parsing this file with the current libcst master branch causes a stack overflow. After some debugging, this appears to be caused by the cache_left_rec macro cloning the expression (here), which in this case causes a gigantic recursive clone of the expression, eventually overflowing the stack.

Screenshot 2023-08-26 at 12 40 04

orf avatar Aug 26 '23 11:08 orf