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.
1744
1744
1745
1745
.. availability :: Windows.
1746
1746
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
+
1747
1752
.. versionadded :: 3.6
1748
1753
See :pep: `529 ` for more details.
1749
1754
1755
+ .. deprecated-removed :: 3.13 3.16
1756
+ Use :envvar: `PYTHONLEGACYWINDOWSFSENCODING ` instead.
1757
+
1750
1758
.. data :: stdin
1751
1759
stdout
1752
1760
stderr
Original file line number Diff line number Diff line change @@ -474,6 +474,10 @@ Deprecated
474
474
security and functionality bugs. This includes removal of the ``--cgi ``
475
475
flag to the ``python -m http.server `` command line in 3.15.
476
476
477
+ * :mod: `sys `: :func: `sys._enablelegacywindowsfsencoding ` function.
478
+ Replace it with :envvar: `PYTHONLEGACYWINDOWSFSENCODING ` environment variable.
479
+ (Contributed by Inada Naoki in :gh: `73427 `.)
480
+
477
481
* :mod: `traceback `:
478
482
479
483
* 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 *
1715
1715
sys__enablelegacywindowsfsencoding_impl (PyObject * module )
1716
1716
/*[clinic end generated code: output=f5c3855b45e24fe9 input=2bfa931a20704492]*/
1717
1717
{
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
+ }
1718
1725
if (_PyUnicode_EnableLegacyWindowsFSEncoding () < 0 ) {
1719
1726
return NULL ;
1720
1727
}
You can’t perform that action at this time.
0 commit comments