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 — Allow omitting `_pyrepl` module · Issue #145035 · python/cpython

Allow omitting _pyrepl module #145035

New issue
Copy link
New issue
Copy link
Closed
Closed
Allow omitting _pyrepl module#145035
Copy link
Assignees
zooba
Labels
3.15bugs and security fixesbugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-replRelated to the interactive shellRelated to the interactive shelltype-featureA feature request or enhancementA feature request or enhancement

Description

@zooba
zooba
opened on Feb 20, 2026
Issue body actions

Currently, launching Python without the _pyrepl module present causes it to abort. It would be better if it simply went into regular repl mode, rather than requiring the user to set an env var, as this would allow distributors to simply omit the module rather than having to patch and rebuild CPython.

cpython/Modules/main.c

Lines 281 to 286 in 175ab31

PyObject *pyrepl = PyImport_ImportModule("_pyrepl.main");
if (pyrepl == NULL) {
fprintf(stderr, "Could not import _pyrepl.main\n");
res = pymain_exit_err_print();
goto done;
}

I would prefer messages about ModuleNotFoundError here to only be shown in verbose mode, though other errors could still cause a full failure (if that's what the maintainers think is best... I disagree, but it's not important to me like ModuleNotFoundError would be).

Linked PRs

  • gh-145035: Allows removing the _pyrepl module to completely disable the modern REPL #145159

Activity

  1. zooba
    added
    topic-replRelated to the interactive shellRelated to the interactive shell
    3.15bugs and security fixesbugs and security fixes
    on Feb 20, 2026
  2. StanFromIreland
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    type-featureA feature request or enhancementA feature request or enhancement
    on Feb 20, 2026
  3. zooba
    self-assigned this
    on Feb 23, 2026
  4. zooba commented on Feb 23, 2026

    @zooba
    zooba
    on Feb 23, 2026
    MemberAuthor
    More actions

    Given how pydoc was refactored, and that I don't want to un-refactor it, it appears that omitting _pyrepl will also break pydoc. I expect that to not be an issue for anyone who's interested in restricting REPL usage (e.g. in production code), so will just leave it documented. Turns out to not be an issue, though pydoc does regress to its most basic form without _pyrepl (which I still think is okay).

  5. zooba
    added a commit that references this issue on Feb 23, 2026

    pythongh-145035: Allows removing the _pyrepl module to completely dis…

    0f565c2
  6. FFY00
    added a commit that references this issue on Mar 9, 2026

    pythongh-145035: Allows removing the _pyrepl module to completely dis…

    1aae478
  7. ambv
    added a commit that references this issue on Mar 10, 2026

    gh-145035: Allows removing the _pyrepl module to completely disable t…

    ae0d287
  8. StanFromIreland commented on Mar 15, 2026

    @StanFromIreland
    StanFromIreland
    on Mar 15, 2026
    Member
    More actions

    Triage: Can this be closed now?

    Reacted by Steve Dower
  9. StanFromIreland
    added
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Mar 15, 2026
  10. zooba
    closed this as completedon Mar 16, 2026
  11. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-145035: Allows removing the _pyrepl module to completely dis…

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

Metadata

Metadata

Assignees

  • @zooba
    zooba

Labels

3.15bugs and security fixesbugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-replRelated to the interactive shellRelated to the interactive shelltype-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — 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.