Skip to content

_csv Reader and Writer types shouldn't be directly instantiable #104265

@chgnrdv

Description

@chgnrdv

The accepted way to create these objects is to use constructor functions _csv.reader() and _csv.writer() with appropriate arguments. Objects that are created through type constructors _csv.Reader and _csv.Writer turn out to be not properly initialized, and operations on them easily lead to crash:

>>> import _csv
>>> _csv.Writer().writerow([])
Segmentation fault (core dumped)
>>> import _csv
>>> list(_csv.Reader())
Segmentation fault (core dumped)

Although this is an internal detail, I'm sure that this should be fixed. I'll submit a PR shortly.
The crash appears on 3.10, 3.11 and current main.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy