sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
801 stars 35 forks source link

sysconfig.get_paths() returns potentially unwanted paths. #6344

Open deathaxe opened 3 months ago

deathaxe commented 3 months ago

Description of the bug

Calling sysconfig.get_paths() within plugin_host returns invalid paths such as

On MacOS it even might fail due to missing _sysconfigdata__darwin_darwin module, which needs to be created at build time.

Steps to reproduce

  1. Start ST in SAFE MODE
  2. Open console
  3. run import sysconfig;sysconfig.get_paths().

Expected behavior

It should return valid python version specific paths like %APPDATA%\Sublime Text\Lib\python38

Actual behavior

It returns invalid python version agnostic paths like %APPDATA%\Sublime Text\Lib\site-packages, which might cause issues, when used.

Note: I haven't checked whether ST would actually import from those. They however may cause issues with some python packages such as coverage v7.x.

Sublime Text build number

4173

Operating system & version

Windows

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

deathaxe commented 3 months ago

FWIW: UnitTesting monkey patches coverage's add_third_party_paths() function which uses sysinfo.get_path() to avoid issues with missing modules or returning invalid paths.

https://github.com/SublimeText/UnitTesting/blob/4238294c83d2dcd839a0035ec7fc6beaa3439a00/unittesting/unit.py#L38