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 support for urlparse 4 #3

Merged
merged 13 commits into from
Jun 8, 2018
Merged

Unicode support for urlparse 4 #3

merged 13 commits into from
Jun 8, 2018

Conversation

malloxpb
Copy link
Member

@malloxpb malloxpb commented Jun 7, 2018

No description provided.

@malloxpb
Copy link
Member Author

malloxpb commented Jun 7, 2018

@lopuhin, this PR should be clearer than the one in the original repository 😄

Copy link
Member

@lopuhin lopuhin left a comment

Choose a reason for hiding this comment

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

@nctl144 I think this is a good start, but would be also great to add tests which check unicode support, and also it would be great to first add travis.ci and tox support to the repo before proceeding with more changes (but that's a topic for another PR) - it greatly simplifies testing and reviewing.

slice_component(url, parsed.query),
slice_component(url, parsed.ref)
))
if six.PY2:
Copy link
Member

Choose a reason for hiding this comment

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

Two points about this bit of code:

  • it would be nice to avoid duplication of code between python 2 and 3
  • I'm not sure unicode function is right here, from the docs: "Create a new Unicode object from the given encoded string. Encoding defaults to the current default string encoding." - I don't think we should rely on default encoding. Also, if we need to do encoding/decoding, it's more efficient to do this in Cython

Copy link
Member

Choose a reason for hiding this comment

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

Regarding returning unicode or not, stdlib urlparse functions can return unicode, so to me it looks more sane to always return unicode even on python 2, maybe it will also be easier to support. Although this might require some extra effort when doing scrapy integration, see e.g. scrapy/scrapy#1949 (comment)

@malloxpb
Copy link
Member Author

malloxpb commented Jun 8, 2018

You are right! I will set up tox and travis in the next PRs :D

@malloxpb malloxpb merged commit 0ea4927 into master Jun 8, 2018
@malloxpb malloxpb deleted the unicodesp branch August 1, 2018 17:07
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

2 participants