-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Handling encodings correctly #900
Conversation
Now only PyPy 3 fails. Let's wait for responses from PyPy. An question: is it OK to just skip the non-ASCII test on PyPy3 and list it as a known issue? |
Skipped PyPy3. PyPy3 is incomplete and full of hacky codes. I don't think virtualenv should completely support it. |
I'm worried this will only happen to work on linuxes with the default locale set as UTF-8. E.g, not on Windows. |
You're right. Appveyor tests failed. I'll try to install Python on Windows and have a look. |
Windows support fixed. |
@yan12125 could you split out the part of this dealing specifically with pypy into a dependant / independent (whichever suits) PR? |
Did you mean changes to |
and |
Done at #927 |
Done :) |
Uhh, maybe I wasn't clear enough. I mean remove all changes that are effectively in #927 from this PR / branch. |
external/pypy-subprocess.patch
Outdated
- ', out).write(sys.prefix.encode("utf-8"))']): # 1.7.2 a9454bce | ||
+ ', out).write(sys.prefix.encode("utf-8"))'], # 1.7.2 a9454bce | ||
+ ['-c', 'import sys;out=sys.stdout;prefix=sys.prefix;' | ||
+ 'prefix=prefix.encode("utf-8") if sys.version_info[0]==3 else prefix;' |
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.
Consider switching this to detect python 2 else do the python 3 behavior.
Is there anything left that should be fixed? |
virtualenv.py
Outdated
@@ -1472,7 +1478,7 @@ def install_files(home_dir, bin_dir, prompt, files): | |||
content = content.replace('__VIRTUAL_ENV__', home_dir) | |||
content = content.replace('__VIRTUAL_NAME__', vname) | |||
content = content.replace('__BIN_NAME__', os.path.basename(bin_dir)) | |||
writefile(os.path.join(bin_dir, name), content) | |||
writefile(os.path.join(bin_dir, name), content, use_fsenc=(name == 'activate.bat')) |
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.
Should also use fsenc for deactivate.bat surely?
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.
Thanks for that. Changed.
Tests are failing on pypy. This should be fixed. Also, I've added a number of comments. The most significant issue is that you're using the wrong encoding for bat files on Windows, but there also seem to be some unneeded changes which concern me. |
Fixes for PyPy is in #927. Originally I put all changes in this PR, and split out supporting changes to #927, as requested by @Ivoz in #900 (comment) |
pypy3 is no longer supported since 49721c1
Sorry, I can't see how to create a lint to an individual comment, but up above I said:
You split out the PyPy changes (which is waiting for someone to review and comment on, but I can't help there as I know nothing about PyPy). You still need (IMO) to split out the general encoding stuff and the Windows script file bits. I'd happily review the Windows script file bits, I don't have an issue with that. For encodings, it's going to be more complex, as we lack a good test suite, but I'm willing to do what I can (with the proviso that I'd like to see tests demonstrating problem cases, not just reports that can't be reproduced elsewhere...) |
2b3f876
to
9dfcb43
Compare
@yan12125 can you rebase this and fix the CI? thanks! |
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.
@yan12125 can you rebase this and fix the CI? thanks!
It's my honor that someone is still looking at my PR. However, as this PR fixes a Python2-only issue, and Python 2 is going to be dead soon, I won't put more efforts into it. If another developer still needs it, feel free to take my branch. |
Fixes #457
On Travis CI pypy 2.5.0 and pypy3 2.4.0 failed. On my machine pypy 5.1 works fine:
And pypy3 gives a strange error:
I guess it's related to a PyPy bug. Reported to https://bitbucket.org/pypy/pypy/issues/2300.
This was migrated from #875 to reparent it to the
master
branch. Please see original pull request for any previous discussion.