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

gh-129573: Fix possible abort from non-string suggestions in calculate_suggestions/_Py_CalculateSuggestions #130997

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

devdanzin
Copy link
Contributor

@devdanzin devdanzin commented Mar 9, 2025

This PR adds a simple check that suggestion candidates are strings in calculate_suggestions(3.12)/_Py_CalculateSuggestions(main), avoiding an abort in debug builds from code like below:

import runpy
runpy._run_module_code("blech", {0: "", "bluch": ""}, "")

The abort only happens in 3.12, because the code in main checks for non-string candidates in _suggestions__generate_suggestions_impl. However, since the affected code is still present in main, this PR is against that branch.

In main, the code above exits the new REPL, which will be reported as a new issue with associated PR.

Found using fusil by @vstinner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants