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
msvc9_query_vcvarsall returns unicode strings on Python 2.7 64-bit and regular strings on 32-bit #992
Comments
This function monkey patch distutils. I think it return, the unpatched function result in one case and in the patched function result in the other case. |
It does seem like a bug. If Python 2.7 os.environ doesn't accept Unicode and msvc9_query_vcvarsall returns only strings in distutils, then the monkeypatch should probably also supply that interface for maximum compatibility. |
I've pushed a fix for this issue. @cztomczak, can you copy the latest msvc.py module from master and confirm it fixes the issue in your environment? |
Oh, and you'll need py27compat.py as well. |
I've added comments to your commit, there seems to be a typo. |
I am sorry, but this issue seems to be invalid and your commits should be reversed. I retested and msvc9_query_vcvarsall() returns unicode on both Python 2.7 32-bit and 64-bit. Previously I have been testing multiple Python flavors and must got confused somewhere on the way. The issue in my code with updating os.environ is still valid, as you can't update it with unicode strings on Python 2.7, however this is not an issue with setuptools. I have checked distutils query_vcvarsall() in distutils/msvc9compiler.py and this function calls str.decode("mbcs"), so it returns unicode strings. So looks like setuptools should be returning unicode strings as well. Again, sorry for causing the trouble. |
However there is one bug in setuptools that I've noticed - but that's a separate issue. EnvironmentInfo().return_env() replaces unicode characters with its ascii equivalents. I've added "C:\Tęstą" to my PATH env variable and setuptools returned it as "C:\Testa" - which is an invalid directory. It's not an issue for me, but looks like a bug. |
msvc9_query_vcvarsall returns environment dict with keys "lib", "libpath", "include" and "PATH". On Python 2.7 32-bit values of this dict are regular strings, however on Python 2.7 64-bit this dict contains unicode strings. So when I later use this dict to update os.environ it throws an error:
Not sure if this is a bug or not, if not you can close it. It's not a big deal for me, I already have it fixed in my code.
The text was updated successfully, but these errors were encountered: