Skip to content

Quadratic parsing time in ftplib.parse227() #162867

Backlog

Description

@tozkdeha

Bug report

I tested ftplib.parse227() directly on CPython 3.11 and 3.15. The parser searches the reply for the numeric fields of a PASV response. For some inputs, it repeats matching work, and parsing time grows quadratically with input length.

I would expect parsing time to scale linearly with input length while preserving the current behavior for valid replies.

I'd be happy to submit a PR to address this.

CPython versions tested on:

3.15, 3.11

Operating systems tested on:

Windows

Linked PRs

Activity

  1. added
    type-bug
    on Nov 30, 2026
  2. added
    stdlib
    performance
    on Nov 30, 2026
  3. encukou commented on Nov 30, 2026

    @encukou
    Member

    I'd be happy to submit a PR to address this.

    Please do. Thank you!

  4. added 6 commits that reference this issue on Nov 30, 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

    performancestdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions