From bfee2f77e16f01a718c1044564ee624f1f2bc328 Mon Sep 17 00:00:00 2001
From: Inada Naoki <songofacandy@gmail.com>
Date: Thu, 28 Dec 2023 17:31:19 +0900
Subject: gh-73427: deprecate  `_enablelegacywindowsfsencoding` (#107729)

---
 Python/sysmodule.c | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'Python/sysmodule.c')

diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 57dc4a1226c..c2de4ecdc8c 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1715,6 +1715,13 @@ static PyObject *
 sys__enablelegacywindowsfsencoding_impl(PyObject *module)
 /*[clinic end generated code: output=f5c3855b45e24fe9 input=2bfa931a20704492]*/
 {
+    if (PyErr_WarnEx(PyExc_DeprecationWarning,
+        "sys._enablelegacywindowsfsencoding() is deprecated and will be "
+        "removed in Python 3.16. Use PYTHONLEGACYWINDOWSFSENCODING "
+        "instead.", 1))
+    {
+        return NULL;
+    }
     if (_PyUnicode_EnableLegacyWindowsFSEncoding() < 0) {
         return NULL;
     }
-- 
cgit v1.2.3