FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.12] gh-129573: Fix abort from non-string suggestions in `calculate_suggestions` by devdanzin · Pull Request #129574 · python/cpython · GitHub

Repository navigation

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

Closed
devdanzin wants to merge 2 commits into
python:3.12from
devdanzin:fix_nonstring_suggestions
Closed

devdanzin wants to merge 2 commits into
python:3.12from
devdanzin:fix_nonstring_suggestions

Conversation

devdanzin commented Feb 2, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

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 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

Copy link
Copy Markdown
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.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL