-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fileinput.hook_encoded has no way to pass arguments to codecs #69974
Comments
Right now there is no way, aside from writing your own openhook, to |
It would be easy to add the errors parameter to fileinput.hook_encoded(). Do you want to provide a patch Laura? |
I haven't made a patch to Python for over 10 years. Before mercurial. :) Where do you start in terms of 'how to submit a patch'? |
Mercurial didn't change the patch submission process (we're talking about making such changes on python-workflow now...or rather enhancements as the current process should continue to work). The only thing that mercurial changed is how you get a copy of the current repo. After that (which is explained in the devguide), just make your changes, do 'hg diff', and attach the diff file to the issue as usual. |
I want to work on this issue. @lac, can you please help as I searched but couldn't find the related files. Where can I find the code for this? |
fileinput is in Python, hence the source is in Lib. Online version is Patching openhook itself looks trivial. A test is the hard part. Laura, can you provide a test case? -- a short (one line?) file that fails with errors=strict and passes with something else? A new test_errors method should be added to class Test_hook_encoded (the last testCase in the file). I think the 'test' method would need revision. |
I haven't seen OP in over 30 days, so am posting my own patch. I've added an optional argument that defaults to strict and gets passed along. I've updated the primary test to verify the argument passing, as well as that things get handled as specified in the documentation at https://docs.python.org/3.5/library/codecs.html This is off-topic, but is there any way I can submit a patch that allows a similar fix for stdin? Presently there is no way at all to pass malformed unicode through fileinput using stdin that I can find. |
Ping. Just wondering if anyone on the nosy list would be willing to help review my patch. :) |
Added comments on Rietveld (follow the "review" link beside the patch link). |
Uploading a new patch to address the issues in previous patch. |
Oh, I forget. Needed updates of the documentation (including the "versionchanged" directive). And would be nice if you add corresponding entities in Doc/whatsnew/3.6.rst, Misc/NEWS and Misc/ACKS. The rest of the patch LGTM. |
Updated documentation in fileinput.rst, Doc/whatsnew/3.6.rst, Misc/NEWS and Misc/ACKS. Thank you so much Serhiy for taking the time to review! |
New changeset 8ab8f5259f09 by Serhiy Storchaka in branch 'default': |
Committed with some changes. Thank you for your contribution Joseph. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: