FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-77102: site: try utf-8 and fallback to locale encoding when reading pth file by methane · Pull Request #117802 · python/cpython · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
add trace for fallback encoding use
  • Loading branch information
methane committed Apr 15, 2024
commit 4a09f06af2ef93e0f194a1b01e1da363ae791967
2 changes: 2 additions & 0 deletions Lib/site.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def addpackage(sitedir, name, known_paths):
# We will deprecate this fallback in the future.
import locale
pth_content = pth_content.decode(locale.getencoding())
_trace(f"Cannot read {fullname!r} as UTF-8. "
f"Using fallback encoding {locale.getencoding()!r}")

for n, line in enumerate(pth_content.splitlines(), 1):
if line.startswith("#"):
Expand Down

Back | FazBrowse Home | New Git URL