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

Python3 support #46

Merged
merged 51 commits into from Apr 11, 2017
Merged

Python3 support #46

merged 51 commits into from Apr 11, 2017

Conversation

utzig
Copy link

@utzig utzig commented Jul 11, 2016

No description provided.

@coveralls
Copy link

coveralls commented Jul 11, 2016

Coverage Status

Coverage increased (+0.04%) to 87.495% when pulling 30fb951 on utzig:python3-support into aa4a178 on ethereum:develop.

@@ -218,7 +222,7 @@ def __init__(self, app, transport):

def get_node(self, nodeid, address=None):
"return node or create new, update address if supplied"
assert isinstance(nodeid, str)
assert isinstance(nodeid, bytes)
assert len(nodeid) == 512 / 8
Copy link
Member

Choose a reason for hiding this comment

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

Just noticed this isn't using floored division //

Copy link
Author

Choose a reason for hiding this comment

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

Yep, I did not change it because the result will always be a whole number (where float == int). Will fix it.

konradkonrad added a commit that referenced this pull request Jul 11, 2016
@@ -218,7 +222,7 @@ def __init__(self, app, transport):

def get_node(self, nodeid, address=None):
"return node or create new, update address if supplied"
assert isinstance(nodeid, str)
assert isinstance(nodeid, bytes)
Copy link
Member

Choose a reason for hiding this comment

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

This statement isn't exactly equivalent in 2/3 since it will return True for both byte and text strings in python 2 but only true for byte strings in python3 .

Copy link
Author

Choose a reason for hiding this comment

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

Since str == bytes in Python 2, I guess this is want we want. What error condition do you have in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind. This isn't a problem. I shouldn't review pull requests prior to having my morning ☕

@coveralls
Copy link

coveralls commented Jul 20, 2016

Coverage Status

Coverage decreased (-0.1%) to 87.322% when pulling f34c91d on utzig:python3-support into aa4a178 on ethereum:develop.

@coveralls
Copy link

coveralls commented Jul 24, 2016

Coverage Status

Coverage increased (+1.03%) to 88.486% when pulling 083ae6b on utzig:python3-support into aa4a178 on ethereum:develop.

@utzig
Copy link
Author

utzig commented Aug 16, 2016

@janx @pipermerriam Guys, from my perspective this is completed. Is there anything that you are still expecting? Any other suggestions?

@@ -62,7 +66,7 @@ def __init__(self, ip, udp_port, tcp_port=0, from_binary=False):
# We only want v4 or v6 addresses
# see https://docs.python.org/2/library/socket.html#socket.getaddrinfo
ips = [
unicode(ai[4][0])
str(ai[4][0]) if PY3 else unicode(ai[4][0])
Copy link
Member

Choose a reason for hiding this comment

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

The use of unicode here bugs me. I'm not sure it's exactly a problem, but unicode isn't defined in python 3 so it's weird to have it inlined even though it won't execute in the py3 environment.

This is more of a nitpick but this would be cleaner to just have a force_text function and remove the if/else. Again, just a nitpick. This is totally functional as is.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't remember why this was required but now checking again, it seems that ipaddress.ip_address only accepts unicode!

https://github.com/phihag/ipaddress/blob/master/ipaddress.py#L159

Copy link
Author

Choose a reason for hiding this comment

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

Btw, since most of our helpers come from rlp.utils, the right place to add an force_text, force_unicode or similar would be there, but I would prefer to do it later.

@pipermerriam
Copy link
Member

@utzig looks good. I left a bunch of comments but I think all of them were just nitpick/stylistic things that don't need to stand in the way of getting this merged.

@utzig
Copy link
Author

utzig commented Aug 16, 2016

@pipermerriam Thanks a lot, that was thorough! I will check the issues you found as soon as I get some free time.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 87.365% when pulling 10248bd on utzig:python3-support into 08b4862 on ethereum:develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 87.365% when pulling 10248bd on utzig:python3-support into 08b4862 on ethereum:develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 88.121% when pulling 1e241d5 on utzig:python3-support into 08b4862 on ethereum:develop.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 88.121% when pulling 1e241d5 on utzig:python3-support into 08b4862 on ethereum:develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 88.121% when pulling 1e241d5 on utzig:python3-support into 08b4862 on ethereum:develop.

@utzig
Copy link
Author

utzig commented Oct 11, 2016

@pipermerriam Hey! Is there anything still blocking this from being merged?

@pipermerriam
Copy link
Member

Was good to go last time I looked it over. I can take another look later
today to be sure.

On Tue, Oct 11, 2016, 6:25 AM Fabio Utzig notifications@github.com wrote:

@pipermerriam https://github.com/pipermerriam Hey! Is there anything
still blocking this from being merged?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#46 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAyTgmDfuDAHkTiCKCRVFllwwL5wEcdtks5qy4BMgaJpZM4JJS4F
.

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.

None yet

4 participants