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
A few py2 unicode fixes (master-specific) #3602
Conversation
We call text_type() on the result's `path` because it may come in as a pathlib object. Ideally we'd work with unicode internally within IO boundaries, but when default_result_renderer() gets the results, _process_results() has already encoded unicode strings. This means our handling fails with non-ascii paths on Python 2: $ datalad create Δ0 [ERROR ] 'ascii' codec can't decode byte 0xce in position 16: ordinal not in range(128) [utils.py:default_result_renderer:506] (UnicodeDecodeError) Avoid the above error by ensuring we use bytes for `path` on Python 2. Note that the added test is oddly parametrized with one case because the next commit will add another case. Re: datalad#3597
The previous commit fixed a similar failure when the non-ascii dataset comes in through PATH, but we still fail if it is given to --dataset: $ datalad create -d Δ1 [ERROR ] 'ascii' codec can't decode byte 0xce in position 16: ordinal not in range(128) [create.py:__call__:209] (UnicodeDecodeError) Fix this by converting the incoming dataset to unicode.
Avoid a unicode error when passing non-ascii paths on Python 2: $ datalad save β0 [ERROR ] 'ascii' codec can't decode byte 0xce in position 0: ordinal not in range(128) [status.py:__call__:292] (UnicodeDecodeError)
Codecov Report
@@ Coverage Diff @@
## master #3602 +/- ##
==========================================
- Coverage 76.94% 76.27% -0.68%
==========================================
Files 269 269
Lines 35413 35419 +6
==========================================
- Hits 27248 27015 -233
- Misses 8165 8404 +239
Continue to review full report at Codecov.
|
gh-3597 has made its way to master. I've updated this PR to drop the temporary commit. range-diff
|
oh green Travis, I thought we lost you forever! ;-) Thanks @kyleam |
This series has a few py2 unicode fixes spurred by gh-3597. It relies on a fix from that PR (temporarily applied here as the tip commit), so I'll mark this PR has a draft until that gh-3597 lands in master.