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

unicode() --> six.u() for Python 3 compatibility #111

Merged
merged 1 commit into from Jan 11, 2018
Merged

Conversation

@cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 11, 2018

unicode() was removed from Python 3 because all strs are unicode.

Executing these lines in Python 3 would raise a NameError.

cclauss
__unicode()__ was removed from Python 3 because all strs are unicode.

Executing these lines in Python 3 would raise a NameError.

* https://pythonhosted.org/six/#six.u
@dbieber
Copy link
Member

@dbieber dbieber commented Jan 11, 2018

lgtm!, thanks

@dbieber dbieber merged commit 9bff9d0 into google:master Jan 11, 2018
2 checks passed
2 checks passed
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cclauss cclauss deleted the cclauss:patch-1 branch Jan 11, 2018
@djizm
Copy link

@djizm djizm commented Jan 12, 2018

@dbieber
Copy link
Member

@dbieber dbieber commented Jun 21, 2018

Turns out six.u does not behave the same as unicode in Python 2. six.u expects a string literal as input, whereas unicode can accept other types like bool and converts them to unicode.
So when value is a bool, six.u errors.

@cclauss
Copy link
Contributor Author

@cclauss cclauss commented Jun 21, 2018

six.text_type() seems like a better substitute.

@dbieber
Copy link
Member

@dbieber dbieber commented Jun 21, 2018

Yeah, that looks right. Thanks.

cclauss pushed a commit to cclauss/python-fire that referenced this pull request Jun 22, 2018
cclauss
dbieber added a commit that referenced this pull request Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.