Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-132835: Add defensive NULL checks in mro resolution#134763

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
emmatyping wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromemmatyping:check-mro-lookup-not-null

Conversation

emmatyping
Copy link
Member

@emmatypingemmatyping commentedMay 27, 2025
edited by bedevere-appbot
Loading

Currently, there are a few places wheretype->tp_mro could theoretically be NULL, but are not in practice. We should defensively assert these NULL values don't occur to ensure that any changes do not introduce a crash and that state invariants are upheld.

The assertions added in this PR are all instances where a NULL value would get passed to something not expected a NULL, so it is better to catch an assertion failure than crash later on.

There are a few cases where it is OK for the return oflookup_tp_mro to be NULL, such as when passed tois_subtype_with_mro, which handles this explicitly.

Currently, there are a few places where tp_mro could theoreticallybecome NULL, but do not in practice. We should defensively check forNULL values to ensure that any changes do not introduce a crash and thatstate invariants are upheld.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@picnixzpicnixzpicnixz approved these changes

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@JelleZijlstraJelleZijlstraAwaiting requested review from JelleZijlstra

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@emmatyping@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp