]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91217: deprecate nis (GH-91606)
authorBrett Cannon <brett@python.org>
Sat, 16 Apr 2022 20:17:30 +0000 (13:17 -0700)
committerGitHub <noreply@github.com>
Sat, 16 Apr 2022 20:17:30 +0000 (13:17 -0700)
Automerge-Triggered-By: GH:brettcannon
Doc/whatsnew/3.11.rst
Lib/test/test_nis.py
Misc/NEWS.d/next/Library/2022-04-16-09-33-14.gh-issue-91217.nt9JFs.rst [new file with mode: 0644]
Modules/nismodule.c

index cd452fc537157510a7c7692846d7ac945087721c..bedf80a72fab5c22a10b769858f06d469044c92f 100644 (file)
@@ -882,6 +882,7 @@ Deprecated
   * :mod:`crypt`
   * :mod:`imghdr`
   * :mod:`msilib`
+  * :mod:`nis`
   * :mod:`nntplib`
 
   (Contributed by Brett Cannon in :issue:`47061`.)
index a22142f4069ba92eb4a8ef25e55e96762fb2bca9..797c9023ad34d474c2f0e56a37a0429972a04ad5 100644 (file)
@@ -1,10 +1,13 @@
 from test import support
 from test.support import import_helper
 import unittest
+import warnings
 
 
 # Skip test if nis module does not exist.
-nis = import_helper.import_module('nis')
+with warnings.catch_warnings():
+    warnings.simplefilter("ignore", DeprecationWarning)
+    nis = import_helper.import_module('nis')
 
 
 class NisTests(unittest.TestCase):
diff --git a/Misc/NEWS.d/next/Library/2022-04-16-09-33-14.gh-issue-91217.nt9JFs.rst b/Misc/NEWS.d/next/Library/2022-04-16-09-33-14.gh-issue-91217.nt9JFs.rst
new file mode 100644 (file)
index 0000000..fc29034
--- /dev/null
@@ -0,0 +1 @@
+Deprecate the nis module.
index cdda1a6a2fb7d40b2f192ceeaa4cb0118435eb67..948f756935db590ddf7745549a7acfb658ed7a61 100644 (file)
@@ -524,5 +524,11 @@ static struct PyModuleDef nismodule = {
 PyMODINIT_FUNC
 PyInit_nis(void)
 {
+    if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                     "'nis' is deprecated and slated for removal in "
+                     "Python 3.13",
+                     7)) {
+        return NULL;
+    }
     return PyModuleDef_Init(&nismodule);
 }