gh-91217: deprecate nis (GH-91606)

Automerge-Triggered-By: GH:brettcannon
This commit is contained in:
Brett Cannon 2022-04-16 13:17:30 -07:00 committed by GitHub
parent 304f5b63e9
commit 9f06ff96cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View File

@ -882,6 +882,7 @@ Deprecated
* :mod:`crypt`
* :mod:`imghdr`
* :mod:`msilib`
* :mod:`nis`
* :mod:`nntplib`
(Contributed by Brett Cannon in :issue:`47061`.)

View 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):

View File

@ -0,0 +1 @@
Deprecate the nis module.

View 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);
}