Skip to content

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

Description

@esadomer

CodeopTests.test_incomplete_warning in Lib/test/test_codeop.py exits warnings.catch_warnings(record=True) before calling the compiler:

with warnings.catch_warnings(record=True) as w:
    warnings.simplefilter("always")
compiler("'\\e' + (")
self.assertEqual(w, [])

As a result, the empty-list assertion cannot detect warnings emitted by that compilation. Keeping the compiler call inside the capture context restores the intended regression coverage.

Verified on CPython main at 9ed41860b411144dbb6d2e4f53489d432364fd19: a runtime compiler replacement that emits SyntaxWarning is accepted by the original test and rejected by the corrected test. The corrected test_codeop tests pass with the actual compilers on a Windows debug build.

Linked PRs

Activity

  1. added 2 commits that reference this issue on Oct 13, 2026
  2. aisk commented on Oct 14, 2026

    @aisk
    Member

    Hi @esadomer, I noticed you've opened a lot of issues (20+) and PRs in a short time, so I suspect they are AI-generated.

    Before we spend more time reviewing them, I want to make sure you've actually reviewed and understood these changes yourself, and that you're taking responsibility for them, as required by our AI guidelines.

  3. esadomer commented on Oct 14, 2026

    @esadomer
    ContributorAuthor

    Hi @aisk, thanks for raising this. I do use AI as an aid, but I review the changes myself and take responsibility for what I submit.

    I opened the PRs as drafts because I don't want to take up maintainers' time before I'm confident that I understand the changes and they're ready for review. So far, I've only had time to complete that process for five PRs, which are the ones I've marked ready for review. The others remain drafts.

    I'll focus on those five first, then review and refine the remaining drafts as time allows. Thanks for your patience :)

  4. aisk commented on Oct 14, 2026

    @aisk
    Member

    Thanks for clarifying! However, it's also better not to open too many issues at once before verified them, since triagers and other contributors may spend time validating and investigating them after they're created.

    So please make sure you've confirmed the problem and checked for duplicates before opening a new issue.

  5. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    on Oct 14, 2026
  6. picnixz commented on Oct 14, 2026

    @picnixz
    Member

    Those kind of issues do not require an issue. You could have opened the PR directly.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions