Repository navigation
Conversation
The types were registered under the names Reader and Writer, so type(csv.reader([])) printed as <class '_csv.Reader'>. In CPython the types are named reader and writer and are exposed in _csv under the aliases Reader and Writer. Rename them, keep the module name, and add the aliases. Signed-off-by: Jeongseop Lim <jeongseop_lim@korea.ac.kr>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #1259
The types of
csv.reader()andcsv.writer()objects were named after their module attributes, so they reported themselves as_csv.Readerand_csv.Writer. CPython names them_csv.readerand_csv.writer(_csv.c#L1055,#L1508) and adds them to the module asReaderandWriter(#L1752-L1762).AS-IS
TO-BE
(matching CPython)
Changes
PythonBuiltinClassType.CSVReaderandCSVWriterreaderandwriter, withmoduleName("_csv")instead ofpublishInModule("_csv"), which would shadow thereader()andwriter()functions.ReaderandWriteraliases inCSVModuleBuiltins.initialize, asSocketModuleBuiltinsdoes forSocketType.test_reader_writer_type_namestotests/test_csv.py.Testing
mx python-jvmon darwin-aarch64, thenmx graalpytest test_csv.py(6 passed).test.test_csvfromlib-pythonpasses (117 passed, same as master). The new test fails on the unpatched build. Type names,__module__, alias identity anddir(_csv)now print the same as CPython 3.13.14.