gh-77102: site: try utf-8 and fallback to locale encoding when reading .pth file (#117802)

This commit is contained in:
Inada Naoki 2024-04-16 12:56:16 +09:00 committed by GitHub
parent 3831144f9c
commit 6dc661bc9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 26 deletions

View file

@ -74,6 +74,10 @@ with ``import`` (followed by space or tab) are executed.
Limiting a code chunk to a single line is a deliberate measure
to discourage putting anything more complex here.
.. versionchanged:: 3.13
The :file:`.pth` files are now decoded by UTF-8 at first and then by the
:term:`locale encoding` if it fails.
.. index::
single: package
triple: path; configuration; file

View file

@ -630,6 +630,13 @@ re
* Rename :exc:`!re.error` to :exc:`re.PatternError` for improved clarity.
:exc:`!re.error` is kept for backward compatibility.
site
----
* :file:`.pth` files are now decoded by UTF-8 first, and then by the
:term:`locale encoding` if the UTF-8 decoding fails.
(Contributed by Inada Naoki in :gh:`117802`.)
sqlite3
-------