You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
csv.get_dialect() and csv.unregister_dialect() raise csv.Error for an unhashable name instead of the hashing error #9507
csv.get_dialect() and csv.unregister_dialect() raise csv.Error for any name that is not a str, but CPython looks the name up in a dict, so an unhashable name raises its hashing error.
Reproduction
importcsvcsv.get_dialect([])
RustPython:
_csv.Error: argument 0 must be a string, not 'list'
CPython:
TypeError: cannot use 'list' as a dict key (unhashable type: 'list')
csv.unregister_dialect([]) behaves the same, and a name whose __hash__ raises ValueError gives _csv.Error instead of that ValueError in both functions.
Python Documentation or reference to CPython source code
CPython get_dialect_from_registry: Modules/_csv.c#L162-L170 reports unknown dialect only when the lookup returns 0, so a hashing error (-1) propagates:
AI disclosure: this report was drafted with Claude Code (claude-opus-5-5) and reviewed by me before submission. The divergence comes from a differential-testing run against CPython 3.12, and every source reference above was checked against the linked revisions.
Activity