gh-75723: Fix double evaluation of .pth and .site files in venvs#149583
Conversation
Based on @asottle branch !asottle-pythongh-75723 but refactored for `main`. This will need a different backport.
The original fix is here: python#147951 but I'm refactoring a bit for `main`.
|
Thanks for the review @ncoghlan ! |
|
We are seeing CI test failures in Cython with the latest CPython main branch since yesterday, and this PR seems the most likely culprit. Some of our tests start Python commands in subprocesses (on Linux/fork) that build code using setuptools, which injects a fake distutils import via a .pth file. The error we see is that the distutils package can no longer be found and imported from the subprocesses, whereas the main process has no problem using it. From a quick look through this change, it feels like a status leak into the child process, but I couldn't immediately pin point one. Any idea what might go wrong here? |
If you're able, please try with #149659 |
I patched the |
This is a more comprehensive fix for Python 3.15 for #75723 reported by @asottile (thanks!). This should not be backported since it's specific to the additions made for PEP 829. I'll evaluate and update !147951 for 3.13 and 3.14 separately.
Huge thanks to @asottile for finding, reporting, and fixing the original bug.