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 — `csv.Sniffer._guess_delimiter()` iterates over all ASCII on each line · Issue #137627 · python/cpython

csv.Sniffer._guess_delimiter() iterates over all ASCII on each line #137627

New issue
Copy link
New issue
Copy link
Closed
Closed
csv.Sniffer._guess_delimiter() iterates over all ASCII on each line#137627
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@maurycy
maurycy
opened on Aug 11, 2025
Issue body actions

Bug report

Bug description:

I know that there were discussions about rewriting CSV Sniffer, and they seem to be on hold, to avoid breaking any code relying on its behavior.

I believe it's possible, though, to still make it significantly faster.

The current code iterates over 127 ASCII characters and counts their occurences on each line, even if they're not present:

cpython/Lib/csv.py

Line 382 in b36d23f

for char in ascii:

It's highly inefficient. We can count only present characters, and backfill zeros.

CPython versions tested on:

3.15

Operating systems tested on:

macOS

Linked PRs

  • gh-137627: Make csv.Sniffer.sniff() delimiter detection 1.6x faster #137628

Activity

  1. maurycy
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 11, 2025
  2. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Aug 11, 2025
  3. serhiy-storchaka
    added this to CSV issues 📊on Aug 13, 2025
  4. hugovk
    added a commit that references this issue on Oct 23, 2025

    gh-137627: Make `csv.Sniffer.sniff()` delimiter detection 1.6x faster (…

    6be6f8f
  5. maurycy commented on Oct 23, 2025

    @maurycy
    maurycy
    on Oct 23, 2025
    ContributorAuthor
    More actions

    #137628 is merged, so closing this as completed.

  6. maurycy
    closed this as completedon Oct 23, 2025
  7. github-project-automation
    moved this to Done in CSV issues 📊on Oct 23, 2025
  8. StanFromIreland
    added a commit that references this issue on Dec 6, 2025

    pythongh-137627: Make `csv.Sniffer.sniff()` delimiter detection 1.6x …

    662abf9
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/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • CSV issues 📊
      Status
      Done
      Show more project fields

    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.