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 reader should support QUOTE_NOTNULL and QUOTE_STRINGS · Issue #113732 · python/cpython

CSV reader should support QUOTE_NOTNULL and QUOTE_STRINGS #113732

New issue
Copy link
New issue
Copy link
Closed
Closed
CSV reader should support QUOTE_NOTNULL and QUOTE_STRINGS#113732
Copy link
Labels
3.13only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Jan 5, 2024
Issue body actions

Feature or enhancement

New quoting rules QUOTE_NOTNULL and QUOTE_STRINGS were introduced in #67230. But they only affect CSV writer, not CSV reader. I think that they should affect CSV reader in the same way as QUOTE_NONNUMERIC does.

  • QUOTE_NOTNULL -- unquoted empty strings are returned as None.
  • QUOTE_STRINGS -- unquoted empty strings are returned as None and unquoted numeric strings are returned as float.

It is perhaps too late to change this in 3.12, so it can be considered as a new feature in 3.13.

Linked PRs

  • gh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in csv.reader #113738

Activity

  1. serhiy-storchaka
    added
    type-featureA feature request or enhancementA feature request or enhancement
    3.13only security fixesonly security fixes
    on Jan 5, 2024
  2. serhiy-storchaka
    added this to CSV issues 📊on Jan 5, 2024
  3. serhiy-storchaka commented on Jan 5, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Jan 5, 2024
    MemberAuthor
    More actions

    On other hand, it is the documented behavior. So this can be considered as a bugfix.

    • It is a bug fix in 3.12.2.
    • It is a new feature in 3.13. 3.12.2 needs a documentation fix, and the change between 3.12 and 3.13 is breaking.
    Reacted by Erlend E. Aasland
  4. serhiy-storchaka
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.12only security fixesonly security fixes
    and removed
    type-featureA feature request or enhancementA feature request or enhancement
    on Jan 5, 2024
  5. serhiy-storchaka
    added 2 commits that reference this issue on Jan 5, 2024

    pythongh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in cs…

    b2e3802

    pythongh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in cs…

    7e1fe69
  6. merwok commented on Jan 5, 2024

    @merwok
    merwok
    on Jan 5, 2024 · Hidden as outdated
    show commentMore actions
  7. serhiy-storchaka commented on Jan 5, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Jan 5, 2024
    MemberAuthor
    More actions

    I think that it is less disruptive than alternatives. For now, not much people use 3.12, and even less use new quoting options. But the mass adaptation of 3.12 will start before releasing 3.13, and at that time more code can be broken by 3.13 changes.

    1. Fix this in 3.12.2. It is only disruptive for these who use new quoting options in 3.12.0 and 3.12.1.
    2. Change the behavior in 3.13 without warning. It is disruptive for all users of 3.12, and also for users of 3.13 who occasionally run their code on the contemporary supported 3.12.
    3. Emit a FutureWarning in 3.13 and 3.14 and change the behavior in 3.15. It is how such changes should be done (when change an established behavior), but it increases the number of affected people and delays the proper solution.
    4. Emit a FutureWarning in 3.12.2+ and 3.13 and change the behavior in 3.14.
    5. Emit a FutureWarning in 3.12.2+ and change the behavior in 3.13.

    It was better to do this before 3.12.0, but it was not done, and now we have no good options. The longer we delay the solution, the worse options we have. cc @Yhg1s

    Reacted by Kirill Podoprigora, Éric, Erlend E. Aasland and Terry Jan Reedy
  8. merwok commented on Jan 5, 2024

    @merwok
    merwok
    on Jan 5, 2024
    Member
    More actions

    Ah, I missed that the options were introduced in 3.12! Option 1 to fix in 3.12.2 seems great then. Great that you tagged the release manager to confirm.

  9. ambv
    changed the title [-]CVS reader should support QUOTE_NOTNULL and QUOTE_STRINGS[/-] [+]CSV reader should support QUOTE_NOTNULL and QUOTE_STRINGS[/+] on Jan 5, 2024
  10. Yhg1s commented on Jan 16, 2024

    @Yhg1s
    Yhg1s
    on Jan 16, 2024
    Member
    More actions

    We should consider observable behaviour, rather than documentation, to be leading. Changing the behaviour in 3.12.2 is too disruptive. Patch releases also should not add new warnings. Given that it was documented to behave this way, I don't think it's necessary to add a new warning for this. That it doesn't work as documented is a bug we can't fix in 3.12, but we can in 3.13.

    Reacted by Erlend E. Aasland
  11. serhiy-storchaka
    added a commit that references this issue on Jan 30, 2024

    gh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in csv.read…

    ea30a28
  12. serhiy-storchaka
    removed
    3.12only security fixesonly security fixes
    on Jan 30, 2024
  13. serhiy-storchaka
    closed this as completedon Jan 30, 2024
  14. github-project-automation
    moved this to Done in CSV issues 📊on Jan 30, 2024
  15. merwok commented on Jan 30, 2024

    @merwok
    merwok
    on Jan 30, 2024
    Member
    More actions

    That it doesn't work as documented is a bug we can't fix in 3.12, but we can in 3.13.

    Would it be useful to add a note in the 3.12 docs?

    Reacted by Erlend E. Aasland and Thomas Gorham
  16. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in cs…

    f77074d
  17. Prometheus3375 commented on Mar 11, 2024

    @Prometheus3375
    Prometheus3375
    on Mar 11, 2024
    Contributor
    More actions

    Adding a note to the documentation will be useful indeed. Was just writing some .csv involved code and because of the documentation of new quoting constants increased python version. Then I realized that these constants does not work for reading as documentation suggests. Hopefully, I found this issue.

    Actually, instead of the note of bugged behavior maybe it will be better to simply remove reader instruction in 3.12 documentation and then add in 3.13 as an addition.

    Also, one of the None is not properly formatted.
    image

  18. merwok commented on Mar 12, 2024

    @merwok
    merwok
    on Mar 12, 2024
    Member
    More actions

    instead of the note of bugged behavior maybe it will be better to simply remove reader instruction in 3.12 documentation

    I don’t think so: it is common to read a newer version of the docs than the Python version you’re using. It’s best to be clear about the behaviour and the change here.

    Does someone want to open a pull request for this?
    If not, we should open a doc ticket to make sure this doesn’t get forgotten.

    Reacted by Sviataslau
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 fixestype-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.