Skip to content

stub for csv.writer can't accept subclass of csv.Dialect #3611

Closed
@Solumin

Description

@Solumin

csv.writer is an import of _csv.writer. #3581 changed _csv.writer to take dialect: Union[_csv.Dialect, str]. This is correct, but now csv.Dialect -- which is distinct from _csv.Dialect -- is no longer a valid argument type for csv.writer.

For example, if someone was to define their own class MyDialect(csv.Dialect), a type checker would be correct to raise a "wrong argument type" error for a call like csv.writer(some_file, dialect=MyDialect()).

As far as I can tell, the stub is technically correct, but _csv.writer should be able to take subclasses of csv.writer. (Or at least I assume that's the intention. Notably, _csv.Dialect has a strict attribute that csv.Dialect lacks.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions