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

python 3 compatibility #22

Merged
merged 1 commit into from
Dec 19, 2013
Merged

python 3 compatibility #22

merged 1 commit into from
Dec 19, 2013

Conversation

dirk-thomas
Copy link
Member

No description provided.

@@ -429,7 +429,10 @@ def string_serializer_generator(package, type_, name, serialize):
yield INDENT+"%s = %s.encode('utf-8')"%(var,var) #For unicode-strings in Python2, encode using utf-8
yield INDENT+"length = len(%s)"%(var) # Update the length after utf-8 conversion

yield pack2("'<I%ss'%length", "length, %s"%var)
yield "if python3:"
yield INDENT+pack2("'<I%sB'%length", "length, *%s"%var)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since in Python 3 the str is encoded it must be written as bytes.

@dirk-thomas
Copy link
Member Author

@tfoote @wjwwood @gerkey Please review.

@tfoote
Copy link
Member

tfoote commented Dec 17, 2013

+1

1 similar comment
@gerkey
Copy link

gerkey commented Dec 17, 2013

+1

@wjwwood
Copy link
Member

wjwwood commented Dec 17, 2013

Looks OK to me +1

dirk-thomas added a commit that referenced this pull request Dec 19, 2013
@dirk-thomas dirk-thomas merged commit 8e22f96 into ros:hydro-devel Dec 19, 2013
@dirk-thomas dirk-thomas deleted the hydro-devel branch December 19, 2013 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants