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 — pylifecycle.c: Multiple init/fini cleanup bugs · Issue #149630 · python/cpython

pylifecycle.c: Multiple init/fini cleanup bugs #149630

New issue
Copy link
New issue
Copy link
Open
Open
pylifecycle.c: Multiple init/fini cleanup bugs#149630
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

@Wulian233
Wulian233
opened on May 10, 2026
Issue body actions

Bug report

Bug description:

Parent: #146102

https://gist.github.com/devdanzin/b022ff2d1304a4b2b8d3d8750abd8da5

pylifecycle.c: Multiple init/fini cleanup bugs

Summary

5 bugs in interpreter lifecycle:

  1. new_interpreter (line 2534): return status bypasses switch-back after save_tstate detach → thread state corruption.
  2. pycore_init_builtins (line 860): Direct return leaks bimod ref.
  3. add_main_module (line 2762): bimod/loader refs leaked on PyDict_SetItemString failure.
  4. finalize_clear_modules_dict (line 1685): Return value of PyObject_CallMethodNoArgs never DECREF'd.
  5. init_sys_streams (line 3019-3031): Unchecked PySys_SetObject for stdin/stdout (stderr correctly checked).

CPython versions tested on:

CPython main branch, 3.15

Operating systems tested on:

No response

Linked PRs

  • gh-149630: Fix pylifecycle multiple init/fini cleanup bugs  #149631

Activity

  1. Wulian233
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 10, 2026
  2. picnixz
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on May 10, 2026
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.