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

[3.12] gh-129573: Fix abort from non-string suggestions in calculate_suggestions #129574

Closed
wants to merge 2 commits into from

Conversation

devdanzin
Copy link
Contributor

@devdanzin devdanzin commented Feb 2, 2025

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

class Parent:
    def __dir__(self):
        return [0]

class WithNonStringAttrs(Parent):
    blech = None

WithNonStringAttrs().bluch

Found using fusil by @vstinner.

@devdanzin devdanzin changed the title gh-129573: Fix abort from non-string suggestions in calculate_suggestions [3.12] gh-129573: Fix abort from non-string suggestions in calculate_suggestions Feb 2, 2025
@ZeroIntensity
Copy link
Member

Thanks for doing this! See my comment: #129573 (comment)

The offending code isn't a problem on 3.13+, but it still exists. Please open a new PR for the main branch.

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

Successfully merging this pull request may close these issues.

2 participants