Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-91217: deprecate nis #91606

Merged
merged 1 commit into from
Apr 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ Deprecated
* :mod:`crypt`
* :mod:`imghdr`
* :mod:`msilib`
* :mod:`nis`
* :mod:`nntplib`

(Contributed by Brett Cannon in :issue:`47061`.)
Expand Down
5 changes: 4 additions & 1 deletion Lib/test/test_nis.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate the nis module.
6 changes: 6 additions & 0 deletions Modules/nismodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}