Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out stackdepth too small in compiler and fix root cause #15

Open
carljm opened this issue Apr 8, 2022 · 1 comment
Open

Figure out stackdepth too small in compiler and fix root cause #15

carljm opened this issue Apr 8, 2022 · 1 comment

Comments

@carljm
Copy link

carljm commented Apr 8, 2022

63b415c papers over the issue, but we should figure out why it's too small in the first place and fix the root cause.

So far I haven't been able to find a repro case, not sure where the checker.py mentioned in the commit message comes from; there's no checker.py in the CPython repo.

carljm referenced this issue Apr 8, 2022
Inada Naoki noticed that Python crashed
when using the following command-line:

    ./python -m py_compile checker.py

Valgrind diagnosed the error.  stackdepth()
in compile.c measures how many basic blocks
there are, then creates a "stack" with enough
space for... something?  Then walks the graph
of blocks and measures the total stack depth,
using "stack" as some sort of context stack.

The problem: in certain circumstances,
"stack" was *way* smaller than it should have
been.  The worst observed one: we thought we
needed 66 slots, but we needed over 150 (!!!).

I "fixed" it by making it realloc() "stack"
in case it's too small.  I don't know why
this should be necessary.  Hopefully someone
more expert with compile.c can take a look.
@carljm
Copy link
Author

carljm commented Apr 8, 2022

With 63b415c reverted, ./python -m compileall Lib/ succeeds, so it doesn't appear that there is any file in the stdlib that exposes this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant