Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ def _get_default_library_roots(cls):

# Make sure we always get at least the standard library location (based on the `os` and
# `threading` modules -- it's a bit weird that it may be different on the ci, but it happens).
roots.append(os.path.dirname(os.__file__))
if hasattr(os, "__file__"):
roots.append(os.path.dirname(os.__file__))
roots.append(os.path.dirname(threading.__file__))
if IS_PYPY:
# On PyPy 3.6 (7.3.1) it wrongly says that sysconfig.get_path('stdlib') is
Expand Down
9 changes: 8 additions & 1 deletion src/debugpy/_vendored/pydevd/pydevd_file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ def _get_library_dir():
break

if library_dir is None or not os_path_exists(library_dir):
library_dir = os.path.dirname(os.__file__)
if hasattr(os, "__file__"):
# "os" is a frozen import an thus "os.__file__" is not always set.
# See https://github.com/python/cpython/pull/28656
library_dir = os.path.dirname(os.__file__)
else:
# "threading" is not a frozen import an thus "threading.__file__" is always set.
import threading
library_dir = os.path.dirname(threading.__file__)

return library_dir

Expand Down
Loading