Skip to content

Warning about remaining subinterpreters should suggest using of concurrent.interpreters.Interpeter #141509

Description

@sergey-miryanov

Bug report

Bug description:

finalize_subinterpreters checks if remaining subinterpreters are present and if so suggest to destroy them via destroy method of internal _interpreters module. I propose to change the warning message to use Interpeter.close as it less confusing.

cpython/Python/pylifecycle.c

Lines 2642 to 2648 in 2fbd396

/* Warn the user if they forgot to clean up subinterpreters. */
(void)PyErr_WarnEx(
PyExc_RuntimeWarning,
"remaining subinterpreters; "
"destroy them with _interpreters.destroy()",
0);

@ZeroIntensity @ericsnowcurrently What do you think?

If yes, I'm ready to fix this.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. ZeroIntensity commented on Nov 13, 2025

    @ZeroIntensity
    Member

    I think it'd be fine to change it, yeah. Eric added that warning long before concurrent.interpreters was a thing.

  2. added a commit that references this issue on Nov 14, 2025
  3. added a commit that references this issue on Nov 14, 2025
  4. added a commit that references this issue on Nov 15, 2025
  5. sergey-miryanov commented on Nov 15, 2025

    @sergey-miryanov
    ContributorAuthor

    PR merged and backported. Closing this now.
    Thanks!

  6. added a commit that references this issue on Dec 6, 2025
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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions