Skip to content
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

Make compilation error readable #380

Merged
merged 2 commits into from
Aug 24, 2017
Merged

Make compilation error readable #380

merged 2 commits into from
Aug 24, 2017

Conversation

gwtnb
Copy link
Member

@gwtnb gwtnb commented Aug 7, 2017

Python 3 prints a line feed in bytes as \n and e.output is bytes, so e.output should be converted to str for readability.

@gwtnb gwtnb added the cat:enhancement Improvements to existing features label Aug 7, 2017
@gwtnb gwtnb added this to the v1.0.3 milestone Aug 7, 2017
@niboshi
Copy link
Member

niboshi commented Aug 7, 2017

I think it's unsafe to assume nvcc output as UTF-8 encoded (See #378).

@gwtnb
Copy link
Member Author

gwtnb commented Aug 7, 2017

Is it safe if 'UTF-8' is replaced with locale.getdefaultlocale()[1] as you wrote at stackoverflow?

@niboshi
Copy link
Member

niboshi commented Aug 8, 2017

Actually I'm not sure...
Some one reports locale.getdefaultlocale is not robust: https://stackoverflow.com/a/25691701/402996

sys.getdefaultencoding and sys.stdout.encoding are confirmed not working in one of our member's environment.

@unnonouno
Copy link
Contributor

How about adding errors='ignore' ?

@niboshi
Copy link
Member

niboshi commented Aug 21, 2017

How about errors='replace'? 'ignore' will simply delete foreign characters.
With 'replace' you can at least see there were some characters which has failed to be decoded.

>>> 'abc[あいう]def'.encode('sjis').decode('utf8', errors='ignore')
'abc[]def'
>>> 'abc[あいう]def'.encode('sjis').decode('utf8', errors='replace')
'abc[������]def'

@niboshi
Copy link
Member

niboshi commented Aug 24, 2017

LGTM!

@niboshi niboshi self-assigned this Aug 24, 2017
@niboshi niboshi merged commit 78e6482 into cupy:v1 Aug 24, 2017
@gwtnb gwtnb deleted the v1-compile-error branch August 25, 2017 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants