Skip to content

gh-159362: Capture warnings from incomplete-input compilation in test_codeop - #159360

Draft
esadomer wants to merge 3 commits into
python:mainfrom
esadomer:fix-20261013-20-codeop-warning-capture-test
Draft

esadomer wants to merge 3 commits into
python:mainfrom
esadomer:fix-20261013-20-codeop-warning-capture-test

Conversation

@esadomer

@esadomer esadomer commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

test_incomplete_warning leaves catch_warnings() before invoking the compiler, so its empty-list assertion cannot detect an emitted warning. Keep compilation inside the capture context. This only repairs test coverage; no NEWS entry is needed.

Validation (Windows debug build): all 14 tests passed with the isolated test-only patch and unchanged codeop implementation. A runtime compiler replacement emitting SyntaxWarning was accepted by the original test and rejected by the corrected test.

Fixes #159362.

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Oct 13, 2026
@esadomer esadomer changed the title Capture warnings from incomplete-input compilation in test_codeop gh-159362: Capture warnings from incomplete-input compilation in test_codeop Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codeop incomplete-input warning test invokes the compiler outside warning capture

1 participant