Skip to content

Make asyncio REPL respect python -E #149319

Closed

Description

@jonathandung

Feature or enhancement

Proposal:

To my knowledge, python -E asks the interpreter to ignore all documented environment variables starting with the PYTHON prefix that might be set. The REPL of asyncio, however, does not follow this:

  1. It does not include a conditional checking sys.flags.ignore_environment, before looking at PYTHON_BASIC_REPL.
  2. Executing PYTHONSTARTUP is guarded by a sys.flag.isolated check (-I) as opposed to sys.flags.ignore_environment (-E). Is this a flaw in the documentation? I think it makes sense to special-case PYTHONSTARTUP.

See the relevant portions of the code here and here, and the documentation part here.

I am making this a feature, because I am not sure if the second part is a bug or intended, in which case it is a documentation fault.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. picnixz commented on May 3, 2026

    @picnixz
    Member

    cc @ambv @pablogsal @kumaraditya303 (strictly speaking, not totally asyncio but still asyncio-related)

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    topic-replRelated to the interactive shell
    on May 3, 2026
  3. jonathandung commented on Jun 25, 2026

    @jonathandung
    ContributorAuthor

    Can this be re-labelled as a bug?

  4. added
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-featureA feature request or enhancement
    on Jun 25, 2026
  5. added a commit that references this issue on Jul 18, 2026
  6. moved this from Todo to Done in asyncioon Jul 19, 2026
  7. terryjreedy commented on Jul 19, 2026

    @terryjreedy
    Member

    If this is really a bug rather than feature issue, should the PR be backported?

  8. moved this from Done to In Progress in asyncioon Jul 19, 2026
  9. picnixz commented on Jul 19, 2026

    @picnixz
    Member

    Yes, I think it should be treated as a bug.

  10. added 3 commits that reference this issue on Jul 19, 2026
  11. moved this from In Progress to Done in asyncioon Jul 19, 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

    stdlibStandard Library Python modules in the Lib/ directorytopic-asynciotopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions