Sorry, something went wrong.
|
Thanks! This needs a NEWS entry, preferrably with a reference to when the bug was introduced. I think this should be backported through to 3.10. |
Sorry, something went wrong.
|
Also, please add tests. There's a dedicated test.support helper for this. Grep through the code base to find it and see how it's used. |
Sorry, something went wrong.
|
@erlend-aasland, are you talking about assert_python_ok? Can't we just check if TypeError with proper message is raised on attempt to create instance/subtype? |
Sorry, something went wrong.
|
There's a disallow_instantiation helper in test.support. |
Sorry, something went wrong.
|
Thanks! This needs a NEWS entry, preferrably with a reference to when the bug was introduced. I think this should be backported through to 3.10. Ah, 3.10 is in security fix mode, so we can only backport to 3.11. |
Sorry, something went wrong.
|
Some history, the original issue for applying PEP-384 to the _csv extension module:
A later (duplicate issue); the linked PRs were closed and incorporated into gh-23224
As you can see, both the Writer and the Reader class had Py_TPFLAGS_BASETYPE when they were converted from static to heap types. Removing that flag is a backwards incompatible change, as third-party software may depend on that behaviour. Please revert that particular change. |
Sorry, something went wrong.
There was a problem hiding this comment.
Changes requested:
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
Looks like 6a02b38 from #23224 introduced this issue. How can I reflect this in NEWS entry text? Should I specify an issue number? Indeed it did. You can reference GitHub issues/PRs with the :gh: Sphinx directive. Here's a suggestion to a NEWS entry: Prevent possible crash by disallow instantiation of the :class:`!_csv.Reader`
and :class:`!_csv.Writer` types. The regression was introduced by :gh:`23224`
in Python 3.10. Patch by <your-name-here>.
|
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @erlend-aasland: please review the changes made to this pull request. |
Sorry, something went wrong.
|
Thank you so much for the report and bugfix, Radislav; good job! |
Sorry, something went wrong.
|
Thanks @chgnrdv for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, something went wrong.
|
GH-104278 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
|
@erlend-aasland, thank you for your patient review :) |
Sorry, something went wrong.
Fixes #104265
Set Py_TPFLAGS_DISALLOW_INSTANTIATION and unset Py_TPFLAGS_BASETYPE flags on Reader and Writer types to prevent their instantiation and subtyping