Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-40077: Convert _csv module to use PyType_FromSpec#20974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
corona10 wants to merge7 commits intopython:masterfromcorona10:bpo-40077-csv

Conversation

@corona10
Copy link
Member

@corona10corona10 commentedJun 19, 2020
edited by bedevere-bot
Loading

Copy link
MemberAuthor

@corona10corona10 left a comment

Choose a reason for hiding this comment

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

@vstinner
Please take a look

I locally tested with _csv module on subinterpreter and module test
And there was no leak.
(But import csv with subinterpreter still has leaks but not related to this PR)

@corona10
Copy link
MemberAuthor

FYI, macOS CI issue is not related to this PR

@corona10corona10 requested a review fromvstinnerJune 19, 2020 10:39
Copy link
MemberAuthor

@corona10corona10 left a comment

Choose a reason for hiding this comment

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

@vstinner

Thanks all of your reviews are applied and no memory leak was found!

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

I'm not sure that it's possible to convert static types to heap types if they have Py_TPFLAGS_BASETYPE, since currently there is no way to retrieve the module from such type.

&strict))
returnNULL;

_csvstate*state=PyType_GetModuleState(type);
Copy link
Member

Choose a reason for hiding this comment

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

PyType_GetModuleState() is not safe if the type has Py_TPFLAGS_BASETYPE flag, which is the case here.

Is there a way to get the defining type in tp_new?

PyErr_Format(_csvstate_global->error_obj,"field larger than field limit (%ld)",
_csvstate_global->field_limit);
PyTypeObject*reader_type=Py_TYPE(self);
_csvstate*state=PyType_GetModuleState(reader_type);
Copy link
Member

Choose a reason for hiding this comment

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

The Reader type has Py_TPFLAGS_BASETYPE: PyType_GetModuleState() is unsafe here.

returnNULL;
}
self->dialect= (DialectObj*)_call_dialect(dialect,keyword_args);
_csvstate*state=get_csv_state(module);
Copy link
Member

Choose a reason for hiding this comment

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

state can be moved at the beginning of the function, to avoid calling get_csv_state() twice.

@bedevere-bot
Copy link

When you're done making the requested changes, leave the comment:I have made the requested changes; please review again.

@vstinner
Copy link
Member

I understand that this PR (if merged) would fixhttps://bugs.python.org/issue14935

@encukou
Copy link
Member

The issue is now closed via#23224.
Thank you for working on it, though!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner requested changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@corona10@bedevere-bot@vstinner@encukou@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp