Repository navigation
Guard the layout item in clear_layout - #142
Merged
Merged
Conversation
PySide6 types QLayout.takeAt as returning QLayoutItem up to 6.10 and QLayoutItem | None from 6.11, where an out-of-range index yields null. The bump to 6.11.2 in dependabot PR #140 therefore turns item = layout.takeAt(0) widget = item.widget() into reportOptionalMemberAccess, because that member access lands on a possibly-None item. This only surfaces now because #139 put lb_gui under basedpyright for the first time; the line itself predates the migration. The while loop makes the None case unreachable in practice, so it is a latent robustness issue rather than an observed crash, but the guard is what makes the call correct under either typing. This is the only takeAt call site in the tree. Verified: basedpyright clean under the installed PySide6 6.10.1, the same narrowing accepted under an Optional-returning stub, lb_gui tests pass, ruff and format clean. The definitive check is #140 rebasing onto this and going green. Co-Authored-By: Claude Code <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfaced by dependabot #140 (pyside6 6.10.1 → 6.11.2), which is currently blocked on it.
The failure
PySide6 types
QLayout.takeAtas returningQLayoutItemup to 6.10 andQLayoutItem | Nonefrom 6.11, where an out-of-range index yields null. I checked both sides: the installed 6.10.1 stub declarestakeAt(...) -> QLayoutItemandmainis 0/0/0, while the error appears only on the 6.11.2 branch.This is only visible now because #139 put
lb_guiunder basedpyright for the first time — the line itself predates the migration and mypy never saw it.Scope
The
while layout.count()condition makes theNonecase unreachable in practice, so this is a latent robustness issue rather than an observed crash. It is the onlytakeAtcall site in the tree, and the CI run on #140 reports exactly one error, so this single guard is the whole blocker.Verification
basedpyrightclean under the installed PySide6 6.10.1 (0 errors, 0 warnings)Item | None, confirming it satisfiesreportOptionalMemberAccessin standard modelb_guitests pass; ruff and formatting clean; all pre-commit hooks passThe definitive check is #140 rebasing onto this and going green.
🤖 Generated with Claude Code