Repository navigation
gh-159288: Avoid segfault by adding missing recursion checks when walking lazy import chains - #159289
Conversation
`lazy import a.b.c as d` nests one placeholder per name component. lazy_import_path() and lazy_import_replay_from() recursed over that chain without a recursion check, so a very long dotted name could overflow the C stack. Raise RecursionError instead, as the rest of lazy import resolution does.
|
FYI, the Android test failure should be fixed by either one of the PRs attached to #159320... |
|
Thanks @brittanyrey for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-159416 is a backport of this pull request to the 3.15 branch. |
…hen walking lazy import chains (GH-159289) (#159416) gh-159288: Avoid segfault by adding missing recursion checks when walking lazy import chains (GH-159289) Add missing recursion checks when walking lazy import chains `lazy import a.b.c as d` nests one placeholder per name component. lazy_import_path() and lazy_import_replay_from() recursed over that chain without a recursion check, so a very long dotted name could overflow the C stack. Raise RecursionError instead, as the rest of lazy import resolution does. (cherry picked from commit 2588362) Co-authored-by: Brittany Reynoso <breynoso@meta.com>
|
|
|
lazy import a.b.c as dnests one placeholder per name component.lazy_import_path()andlazy_import_replay_from()recursed over that chain without a recursion check, so a very long dotted name could overflow the stack.Add guards to raise a
RecursionErrorinstead of failing into a segfault.