Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbfee2f7

Browse files
authored
gh-73427: deprecate_enablelegacywindowsfsencoding (#107729)
1 parent7ab9efd commitbfee2f7

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

‎Doc/library/sys.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,9 +1744,17 @@ always available.
17441744

17451745
..availability::Windows.
17461746

1747+
..note::
1748+
Changing the filesystem encoding after Python startup is risky because
1749+
the old fsencoding or paths encoded by the old fsencoding may be cached
1750+
somewhere. Use:envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead.
1751+
17471752
..versionadded::3.6
17481753
See:pep:`529` for more details.
17491754

1755+
..deprecated-removed::3.13 3.16
1756+
Use:envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead.
1757+
17501758
..data::stdin
17511759
stdout
17521760
stderr

‎Doc/whatsnew/3.13.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,10 @@ Deprecated
474474
security and functionality bugs. This includes removal of the ``--cgi``
475475
flag to the ``python -m http.server`` command line in 3.15.
476476

477+
*:mod:`sys`::func:`sys._enablelegacywindowsfsencoding` function.
478+
Replace it with:envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable.
479+
(Contributed by Inada Naoki in:gh:`73427`.)
480+
477481
*:mod:`traceback`:
478482

479483
* The field *exc_type* of:class:`traceback.TracebackException` is
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deprecate:func:`sys._enablelegacywindowsfsencoding`. Use
2+
:envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead. Patch by Inada Naoki.

‎Python/sysmodule.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,13 @@ static PyObject *
17151715
sys__enablelegacywindowsfsencoding_impl(PyObject*module)
17161716
/*[clinic end generated code: output=f5c3855b45e24fe9 input=2bfa931a20704492]*/
17171717
{
1718+
if (PyErr_WarnEx(PyExc_DeprecationWarning,
1719+
"sys._enablelegacywindowsfsencoding() is deprecated and will be "
1720+
"removed in Python 3.16. Use PYTHONLEGACYWINDOWSFSENCODING "
1721+
"instead.",1))
1722+
{
1723+
returnNULL;
1724+
}
17181725
if (_PyUnicode_EnableLegacyWindowsFSEncoding()<0) {
17191726
returnNULL;
17201727
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp