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 — bpo-14935: Remove static state from the _csv module by encukou · Pull Request #23224 · python/cpython

Conversation

@encukou

@encukou encukou commented Nov 10, 2020 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This merges code/ideas from gh-20974 and gh-16078, and uses the new _PyType_GetModuleByDef.

Co-authored-by: Marcel Plch [email protected]
Co-authored-by: Eddie Elizondo [email protected]
Co-authored-by: Hai Shi [email protected]

https://bugs.python.org/issue14935

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@encukou Marcel Plch
@eduardo-elizondo @shihai1991
Remove static state from the _csv module
a2a0e6f
Uses code from: python#16078

Co-authored-by: Marcel Plch <[email protected]>
Co-authored-by: Eddie Elizondo <[email protected]>
Co-authored-by: Hai Shi <[email protected]>
@encukou
encukou requested a review from vstinner November 10, 2020 14:16
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 10, 2020
@bedevere-bot bedevere-bot added the awaiting core review label Nov 10, 2020
shihai1991
shihai1991 reviewed Nov 10, 2020
View reviewed changes
Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

shihai1991
shihai1991 reviewed Nov 10, 2020
View reviewed changes
Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@encukou
Use PyModule_AddObjectRef and PyTuple_Pack
09802b2
vstinner
vstinner reviewed Nov 12, 2020
View reviewed changes
Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

encukou added 7 commits November 13, 2020 20:36
@encukou
Rename m_state to module_state
1665ac7
@encukou
Use Py_CLEAR rather than Py_XDECREF
23f844a
@encukou
Use module rather than m
8d1f95d
@encukou
Factor out calling _PyType_GetModuleByDef & PyModule_GetState
2c60895
@encukou
Set freed pointers to NULL
e69d0a1
@encukou
Only call get_csv_state up to once per function
fb93e7f
@encukou
Pass module_state directly to _call_dialect
b62987b
vstinner
vstinner reviewed Nov 17, 2020
View reviewed changes
Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_csv.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

encukou added 2 commits December 8, 2020 14:58
@encukou
Add NULL check for _csv_state_from_type
f12a768
@encukou
Use Py_NewRef where appropriate
f302029
vstinner
vstinner approved these changes Dec 8, 2020
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. IMO the code is cleaner with your changes, thanks.

I just added a minor coding style remark, feel free to ignore it ;-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/_csv.c Outdated

PyType_Spec Writer_Type_spec = {
"_csv.writer",
sizeof(WriterObj),

@vstinner vstinner Dec 8, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use ".m_xxx = xxx" syntax here, as you did for the other spec below. Same remark for Reader_Type_spec.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Dec 8, 2020
@encukou
Use designated initializers for spec structs
b8c37bf
vstinner
vstinner approved these changes Dec 8, 2020
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
shihai1991
shihai1991 approved these changes Dec 8, 2020
View reviewed changes

@shihai1991 shihai1991 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no other comments, so LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@encukou
encukou merged commit 6a02b38 into python:master Dec 15, 2020
@bedevere-bot bedevere-bot removed the awaiting merge label Dec 15, 2020
@encukou
encukou deleted the pep-573-walker-and-csv branch December 15, 2020 14:14
This was referenced Dec 15, 2020
bpo-40077: Convert _csv module to use PyType_FromSpec #20974
Closed
bpo-34533: Remove all static state from _csv module #16078
Closed
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
@encukou Marcel Plch
@eduardo-elizondo @shihai1991 @adorilson
bpo-14935: Remove static state from the _csv module (pythonGH-23224)
94dc70f
Uses code from: python#16078

Co-authored-by: Marcel Plch <[email protected]>
Co-authored-by: Eddie Elizondo <[email protected]>
Co-authored-by: Hai Shi <[email protected]>
@erlend-aasland erlend-aasland mentioned this pull request May 12, 2021
bpo-44116: Add GC support to _csv heap types #26074
Merged
This was referenced May 7, 2023
gh-104265 Disallow instantiation of _csv.Reader and _csv.Writer #104266
Merged
gh-101819: Isolate _io #101948
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes
@shihai1991 shihai1991 shihai1991 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@encukou @vstinner @shihai1991 @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.