Skip to content

Commit 56078f5

Browse files
authored
csv.Dialect doesn't actually subclass _csv.Dialect (#12808)
It does a weird wrapping thing instead: https://github.com/python/cpython/blob/2a5cdb251674ce8d9a824c102f7cd846d944cfa4/Lib/csv.py#L114
1 parent 2412c7c commit 56078f5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

stdlib/_csv.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import csv
12
import sys
23
from _typeshed import SupportsWrite
34
from collections.abc import Iterable, Iterator
@@ -20,7 +21,7 @@ _QuotingType: TypeAlias = int
2021

2122
class Error(Exception): ...
2223

23-
_DialectLike: TypeAlias = str | Dialect | type[Dialect]
24+
_DialectLike: TypeAlias = str | Dialect | csv.Dialect | type[Dialect | csv.Dialect]
2425

2526
class Dialect:
2627
delimiter: str

stdlib/csv.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ from _csv import (
44
QUOTE_MINIMAL as QUOTE_MINIMAL,
55
QUOTE_NONE as QUOTE_NONE,
66
QUOTE_NONNUMERIC as QUOTE_NONNUMERIC,
7-
Dialect as _Dialect,
87
Error as Error,
98
__version__ as __version__,
109
_DialectLike,
@@ -59,7 +58,15 @@ if sys.version_info < (3, 13):
5958

6059
_T = TypeVar("_T")
6160

62-
class Dialect(_Dialect):
61+
class Dialect:
62+
delimiter: str
63+
quotechar: str | None
64+
escapechar: str | None
65+
doublequote: bool
66+
skipinitialspace: bool
67+
lineterminator: str
68+
quoting: _QuotingType
69+
strict: bool
6370
def __init__(self) -> None: ...
6471

6572
class excel(Dialect): ...

0 commit comments

Comments
 (0)