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.

Author ag6502
Recipients ag6502, amaury.forgeotdarc, benjamin.peterson, ggenellina, serhiy.storchaka, terry.reedy
Date 2012-07-07.13:31:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1341667874.77.0.0246247163794.issue5765@psf.upfronthosting.co.za>
In-reply-to
Content
This is a fix for this issue.

The solution was to add two fields (recursion_depth and
recursion_limit) to the symbol table object and just increment and
check the depth in symtable_visit_expr raising a RuntimeError in case
the limit is exceeded.

The test case added also covers other similar cases (a.b.b.b.b.b...
and a[0][0][0][0]....)

There is no depth check in when visiting statement because I cannot
think to a way to nesting statements too much without getting other
errors before. If there is a way to do it, it would be trivial to also
cover that part.

The patch uses the current depth and current recursion limit but
multiplies them for a factor because I suppose that the amount of C
stack used by the compiler per recursion is smaller than the amount
used by the interpreter; the constant in the patch is 4. Using a
constant of 1 (i.e. just using the normal recursion limit) doesn't
allow a previously existing test about big expressions to pass.
History
Date User Action Args
2012-07-07 13:31:15ag6502setrecipients: + ag6502, terry.reedy, amaury.forgeotdarc, ggenellina, benjamin.peterson, serhiy.storchaka
2012-07-07 13:31:14ag6502setmessageid: <1341667874.77.0.0246247163794.issue5765@psf.upfronthosting.co.za>
2012-07-07 13:31:14ag6502linkissue5765 messages
2012-07-07 13:31:14ag6502create