-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
PEX behaving differently on Python 3 for python_eval.py
#6354
Comments
Noted I started digging on this but I'm blocked here for a bit on hitting https://setuptools.readthedocs.io/en/latest/history.html#v38-4-1 for the cryptography distribution. I'll see if I can find time to fix that and circle back. |
@jsirois : You can avoid that one by downgrading to python 3.6, iirc. |
Sure, but that's not something we can in-general expect of folks. I'll try to fix things between pants & pex wrt setuptools deps so this works. |
Filed #6363 for the python 3.7 issue and I'll change us from |
@Eric-Arellano just checking in that this is still an issue. I could not repro locally yesterday. |
@jsirois Yes I think so. You'll have to apply this diff:
We're skipping the tests if PY3 to allow CI to run everything else. |
This was a failure to decode
From that list, the |
Without this, the template was rendered with literal `\n`'s under python3. I did not linger to figure out how the rendered string could possibly load in a python interpreter with no errors! Fixes pantsbuild#6354
Without this, the template was rendered with literal `\n`'s under python3. I did not linger to figure out how the rendered string could possibly load in a python interpreter with no errors! Also fix the `BuildInvalidator`. Previously it wrote and read keys asymmetrically; now the key is uniformly represented (and compared!) as a unicode utf-8 string in memory. Fixes #6354 Fixes #6384
Problem
Several of the tests are supposed to raise errors, but aren’t, such as https://github.com/pantsbuild/pants/blob/master/contrib/python/tests/python/pants_test/contrib/python/checks/tasks/test_python_eval.py#L180
We isolated it to this line https://github.com/pantsbuild/pants/blob/master/contrib/python/src/python/pants/contrib/python/checks/tasks/python_eval.py#L168.
pex.run()
is returning status code 0 in Py3, when it should be 1.Steps to reproduce
./pants clean-all
./pants --python-setup-interpreter-constraints='["CPython>=3.5"]' --no-test-pytest-timeouts test contrib/python/tests/python/pants_test/contrib/python/checks/tasks:
Things not an issue
Stdout
We override stdout in
pex.run()
, which I thought would cause issues becausestdout
takes bytes in Py2 but unicode in Py3. No longer passing the parameters doesn’t work though.Interpreter mismatch
the
interpreter
arg toPEX()
andPEXBuilder()
is for 2.7, but forpex_info.build_properties
it’s 3I thought this mismatch would cause issues? But I changed
python_setup.py
to require py3, which makesinterpreter
be py3, and it still fails.Pex 1.4.5
Using this version vs. others isn't the breaking point.
Issue is likely how PEX is built
@wisechengyi found that after the PEX is built, it doesn't matter which interpreter you use. If the PEX was created with Python 2, it will always work. If it was created with Python 3, it will never work.
To reproduce, apply this diff
and get the
exec_pex_path
to get the chroot, then run the PEX with your system's Python likepython2.7 <exec_pex_path>
.The text was updated successfully, but these errors were encountered: