summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/site.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index f1a6d9c..7eace19 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -185,7 +185,9 @@ def addpackage(sitedir, name, known_paths):
return
try:
- pth_content = pth_content.decode()
+ # Accept BOM markers in .pth files as we do in source files
+ # (Windows PowerShell 5.1 makes it hard to emit UTF-8 files without a BOM)
+ pth_content = pth_content.decode("utf-8-sig")
except UnicodeDecodeError:
# Fallback to locale encoding for backward compatibility.
# We will deprecate this fallback in the future.