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.has_header() leaks ValueError instead of csv.Error for an inconsistent guessed dialect · Issue #153634 · python/cpython

csv.Sniffer.has_header() leaks ValueError instead of csv.Error for an inconsistent guessed dialect #153634

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
csv.Sniffer.has_header() leaks ValueError instead of csv.Error for an inconsistent guessed dialect#153634
Copy link
Labels
3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesstdlibStandard 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

@tonghuaroot
tonghuaroot
opened on Jul 13, 2026
Issue body actions

Bug description:

csv.Sniffer.sniff() can guess a dialect whose delimiter equals its quote character. Using such a dialect leaks a raw ValueError from the _csv extension instead of the module's csv.Error; csv.Sniffer.has_header(), which builds a reader from the sniffed dialect, is the common trigger.

import csv
csv.Sniffer().has_header("''")   # ValueError, not csv.Error

CPython versions tested on:

3.13, 3.14, 3.15

Operating systems tested on:

macOS

Linked PRs

  • gh-153634: Raise csv.Error, not ValueError, from csv.Sniffer for an inconsistent guessed dialect #153635

Activity

  1. aisk
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Jul 13, 2026
  2. aisk
    added this to CSV issues 📊on Jul 13, 2026
  3. serhiy-storchaka
    added
    3.13only security fixesonly security fixes
    3.14bugs and security fixesbugs and security fixes
    3.15bugs and security fixesbugs and security fixes
    on Jul 21, 2026
  4. encukou commented on Aug 3, 2026

    @encukou
    encukou
    on Aug 3, 2026
    Member
    More actions

    In the main branch, the sniffer was rewritten with this issue fixed.

    I don't think fixing this in maintenance branches is worth it -- if someone wrote a workaround or otherwise depends on the existing behaviour, their code can break. Better to break them just once, in 3.16.

    I'll close; if anyone disagrees we can reopen.

    Reacted by tonghuaroot (童话)
  5. encukou
    closed this as not plannedon Aug 3, 2026
  6. github-project-automation
    moved this to Done in CSV issues 📊on Aug 3, 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

    3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesstdlibStandard 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.