File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 1+ Deprecate :func: `sys._enablelegacywindowsfsencoding `. Use
2+ :envvar: `PYTHONLEGACYWINDOWSFSENCODING ` instead. Patch by Inada Naoki.
Original file line number Diff line number Diff line change @@ -1715,6 +1715,13 @@ static PyObject *
17151715sys__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+ return NULL ;
1724+ }
17181725 if (_PyUnicode_EnableLegacyWindowsFSEncoding () < 0 ) {
17191726 return NULL ;
17201727 }
You can’t perform that action at this time.
0 commit comments