8000 gh-91217: deprecate nis (GH-91606) · python/cpython@9f06ff9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f06ff9

Browse files
authored
gh-91217: deprecate nis (GH-91606)
Automerge-Triggered-By: GH:brettcannon
1 parent 304f5b6 commit 9f06ff9

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

Doc/whatsnew/3.11.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ Deprecated
882882
* :mod:`crypt`
883883
* :mod:`imghdr`
884884
* :mod:`msilib`
885+
* :mod:`nis`
885886
* :mod:`nntplib`
886887

887888
(Contributed by Brett Cannon in :issue:`47061`.)

Lib/test/test_nis.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
from test import support
22
from test.support import import_helper
33
import unittest
4+
import warnings
45

56

67
# Skip test if nis module does not exist.
7-
nis = import_helper.import_module('nis')
8+
with warnings.catch_warnings():
9+
warnings.simplefilter("ignore", DeprecationWarning)
10+
nis = import_helper.import_module('nis')
811

912

1013
class NisTests(unittest.TestCase):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate the nis module.

Modules/nismodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,5 +524,11 @@ static struct PyModuleDef nismodule = {
524524
PyMODINIT_FUNC
525525
PyInit_nis(void)
526526
{
527+
if (PyErr_WarnEx(PyExc_DeprecationWarning,
528+
"'nis' is deprecated and slated for removal in "
529+
"Python 3.13",
530+
7)) {
531+
return NULL;
532+
}
527533
return PyModuleDef_Init(&nismodule);
528534
}

0 commit comments

Comments
 (0)
0