-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
Support PYTHONSAFEPATH #1700
base: master
Are you sure you want to change the base?
Support PYTHONSAFEPATH #1700
Conversation
Thanks! I'll have to look into what you are saying about the check in execfile. That code gets very fiddly. |
All done! |
Hmm, this is hard to test. The test might work better in |
I've proposed some test fixes here: flying-sheep#1 |
OK, I’ll take a look tomorrow! |
OK, looks good. Seems like on windows, there‘s an additional line "d:\\a\\coveragepy\\coveragepy\\.tox\\py311\\scripts\\coverage.exe", in the PYTHONPATH. I don’t know why, and I don’t have access to windows to figure it out. |
I've started looking into the failing Windows builds in hopes of getting this PR unblocked. I'm currently suspicious of the PYTHONSAFEPATH behavior of CPython itself on Windows. This diff in particular seems sus. At first glance it looks like it should be a no-op, since the function referenced in the comment was already not used within that file. It's odd to see what appears to be a cleanup diff included in an otherwise very focused commit, though, and I wonder whether it was unintentional and/or had unintended side effects. It may have also been a follow-up to changes from a previous commit, but I haven't found any candidates yet. The referenced This might be a red herring, but I have to go now, so figured I'd go ahead and share it in case I'm not able to return to the case for a while. |
Additional data points, which seem more relevant:
I feel like there's probably enough info there to figure out what's happening, but I'm having trouble putting the pieces together and have to go again. Let me know if anyone else has a lightbulb moment, and I'll follow up with some more detailed debug dumps later. |
Maybe we can ask a core dev about this? |
Hi, as said, I don’t have access to windows. Can you suggest a course of action that gets this merged? Like “just remove that entry during test execution and add a TODO with a link to an issue we open for it” |
Hello? |
Fixes #1696
Unfortunately, the test I added doesn’t really do much, since the code always hits this branch while testing.
coveragepy/coverage/execfile.py
Lines 106 to 117 in 8086c70
I manually confirmed that my change works, but allowing to actually test
PyRunner.prepare
, more extensive changes to the test setup are necessary that I don’t feel comfortable making.Once a change is made that skips that branch during testing, my test will start working and catch breakage to the PYTHONSAFEPATH handling.