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 — readline leaks the completer delimiters buffer on re-import · Issue #160353 · python/cpython

readline leaks the completer delimiters buffer on re-import #160353

New issue
Copy link
New issue
Copy link
Open
#160379
Open
readline leaks the completer delimiters buffer on re-import#160353
#160379
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@ashm-dev
ashm-dev
opened on Oct 22, 2026
Issue body actions

Bug report

Re-importing readline after removing it from sys.modules leaks the buffer allocated by set_completer_delims().

Reproduced on Linux with an AddressSanitizer build of CPython main, commit ad101c3 (3.16.0a1+dev):

  ASAN_OPTIONS=detect_leaks=1 ./python -I -S -B -c 'import readline, sys; readline.set_completer_delims("x" * 28); del sys.modules["readline"]; import readline'

LeakSanitizer reports 29 bytes leaked in one allocation, originating from strdup() in readline_set_completer_delims_impl() (Modules/readline.c:853).

During re-import, setup_readline() overwrites completer_word_break_characters with a new allocation without freeing the previous buffer. Repeated calls to set_completer_delims() without re-importing do not
reproduce the leak.

Related reports: #94064, #152398.

CPython versions tested on:

CPython main branch, 3.16, 3.15

Operating systems tested on:

Linux

Linked PRs

  • gh-160353: Fix readline memory leak on re-import #160379

Activity

  1. ashm-dev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Oct 22, 2026
  2. picnixz commented on Oct 22, 2026

    @picnixz
    picnixz
    on Oct 22, 2026 · Hidden as resolved
    show commentMore actions
  3. picnixz
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Oct 22, 2026
  4. ashm-dev commented on Oct 25, 2026

    @ashm-dev
    ashm-dev
    on Oct 25, 2026 · Hidden as resolved
    Author
    show commentMore actions
  5. picnixz commented on Oct 28, 2026

    @picnixz
    picnixz
    on Oct 28, 2026 · Hidden as resolved
    show commentMore actions
  6. ashm-dev commented on Nov 1, 2026

    @ashm-dev
    ashm-dev
    on Nov 1, 2026 · Hidden as resolved
    Author
    show commentMore actions
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

    extension-modulesC modules in the Modules dirC modules in the Modules dirtype-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 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.