-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
@lopuhin, this PR should be clearer than the one in the original repository 😄 |
There was a problem hiding this 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.
urlparse4/cgurl.pyx
Outdated
slice_component(url, parsed.query), | ||
slice_component(url, parsed.ref) | ||
)) | ||
if six.PY2: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
You are right! I will set up tox and travis in the next PRs :D |
No description provided.