File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/debugpy/_vendored/pydevd Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,8 @@ def _get_default_library_roots(cls):
155155
156156 # Make sure we always get at least the standard library location (based on the `os` and
157157 # `threading` modules -- it's a bit weird that it may be different on the ci, but it happens).
158- roots .append (os .path .dirname (os .__file__ ))
158+ if hasattr (os , "__file__" ):
159+ roots .append (os .path .dirname (os .__file__ ))
159160 roots .append (os .path .dirname (threading .__file__ ))
160161 if IS_PYPY :
161162 # On PyPy 3.6 (7.3.1) it wrongly says that sysconfig.get_path('stdlib') is
Original file line number Diff line number Diff line change @@ -88,7 +88,14 @@ def _get_library_dir():
8888 break
8989
9090 if library_dir is None or not os_path_exists (library_dir ):
91- library_dir = os .path .dirname (os .__file__ )
91+ if hasattr (os , "__file__" ):
92+ # "os" is a frozen import an thus "os.__file__" is not always set.
93+ # See https://github.com/python/cpython/pull/28656
94+ library_dir = os .path .dirname (os .__file__ )
95+ else :
96+ # "threading" is not a frozen import an thus "threading.__file__" is always set.
97+ import threading
98+ library_dir = os .path .dirname (threading .__file__ )
9299
93100 return library_dir
94101
You can’t perform that action at this time.
0 commit comments