Closed catwell closed 1 month ago
This appears to be related to a security change that came from the pylance team.
@rchiodo, could you please move this issue to the pylance-release bug tracker and investigate? Thanks!
Not sure how rye is using the cwd to add the .venv path to search paths but I can repro.
I think the security change was not necessary in this case though. We can still run the interpreter in the current working directory. The code already excludes the cwd for all modules except os and sys, and it seems those can't be overwritten by the user. At least I can't get python to load a 'sys.py' or 'os.py' in my current folder with import sys
.
Going to transfer this back to pyright as it was fixed there and the original user isn't actually on pylance. I don't think the bug actually affects pylance because our cwd was never where the source file was.
This is addressed in pyright 1.1.372.
Steps to reproduce: install rye, then for instance:
This worked up to version 1.1.370, with 1.1.371 you get:
I suppose the reason is microsoft/pyright#8341, because the behavior of the Python interpreter changes depending on the current path.
Is there a way to disable this sandboxing of the interpreter?
(I think this is an issue with pyright and not Rye but I have still opened a bug on their end as well.)