GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix various bugs in compiler pipeline from bug report · Issue #146442 · python/cpython

Fix various bugs in compiler pipeline from bug report #146442

New issue
Copy link
New issue
Copy link
Closed
Closed
Fix various bugs in compiler pipeline from bug report#146442
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@A0su
A0su
opened on Mar 26, 2026
Issue body actions

Bug report

Bug description:

This is a sub-issue of #146102, details copied from gist:

Compiler Pipeline (codegen + compile + symtable + flowgraph + assemble) | 6 FIX

codegen.c (6,632 lines) — 4 FIX

  1. NULL deref + ref leak in codegen_setup_annotations_scope (line 716-720): PyLong_FromLong result not NULL-checked, passed to ADDOP_LOAD_CONST which dereferences it. Also never DECREF'd even on success.
  2. Ref leak of mangled in codegen_nameop (line 3280): RETURN_IF_ERROR(scope) early-returns without DECREF'ing mangled from _PyCompile_MaybeMangle.
  3. : 7 macro sites between allocation and consumption can early-return, leaking mangled.
  4. Unchecked _PyCompile_PushFBlock in codegen_unwind_fblock_stack (line 669): Return value silently discarded, error lost, frame block stack left inconsistent.

compile.c (1,772 lines) — 1 FIX

  1. Ref leak of orig in _PyCompile_TweakInlinedComprehensionScopes (line 1096-1114): PyDict_GetItemRef returns new ref in orig, never DECREF'd on any path (success or error). Leaks on every inlined comprehension.

assemble.c (802 lines) — 1 FIX

  1. assemble_emit_instr returns ERROR without exception (line 420-421): Bytecode overflow check returns ERROR without PyErr_NoMemory() → SystemError.

symtable.c (3,355 lines) — 0 FIX (clean)

flowgraph.c (4,088 lines) — 0 FIX (clean)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

  • gh-146442: Fix various bugs in compiler pipeline from bug report #146443

Activity

  1. A0su
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Mar 26, 2026
  2. JelleZijlstra commented on Mar 26, 2026

    @JelleZijlstra
    JelleZijlstra
    on Mar 26, 2026
    Member
    More actions

    NULL deref + ref leak in codegen_setup_annotations_scope (line 716-720): PyLong_FromLong result not NULL-checked, passed to ADDOP_LOAD_CONST which dereferences it. Also never DECREF'd even on success.

    This called with a constant small integer, so we'll always get an interned and immortal object. For clarity still better to DECREF it, though.

    Reacted by Brandon
  3. devdanzin
    added a parent issue on Mar 26, 2026
    • Umbrella issue: bugs found using cpython-review-toolkit #146102
  4. picnixz
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Mar 26, 2026
  5. vstinner commented on Mar 27, 2026

    @vstinner
    vstinner
    on Mar 27, 2026
    Member
    More actions

    Do you plan to write a PR to fix these issues?

  6. brianschubert commented on Mar 27, 2026

    @brianschubert
    brianschubert
    on Mar 27, 2026
    Contributor
    More actions

    @vstinner they opened a PR against the parent issue. I just edited the PR to point to this issue instead

    Reacted by Victor Stinner
  7. vstinner
    added a commit that references this issue on Mar 30, 2026

    gh-146442: Fix various bugs in compiler pipeline (#146443)

    ca95e97
  8. A0su commented on Mar 30, 2026

    @A0su
    A0su
    on Mar 30, 2026
    ContributorAuthor
    More actions

    PR is merged, closing issue

  9. A0su
    closed this as completedon Mar 30, 2026
  10. maurycy
    added a commit that references this issue on Mar 31, 2026

    Merge branch 'main' into tachyon-ndjson-kolektor

    9836ffa
  11. clin1234
    added a commit that references this issue on Apr 16, 2026

    pythongh-146442: Fix various bugs in compiler pipeline (python#146443)

    a82862c
  12. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-146442: Fix various bugs in compiler pipeline (python#146443)

    edb1b9b
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.