summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/whatsnew/3.11.rst1
-rw-r--r--Lib/test/test_spwd.py5
-rw-r--r--Misc/NEWS.d/next/Library/2022-04-17-12-32-40.gh-issue-91217.ms49Rg.rst1
-rw-r--r--Modules/spwdmodule.c7
4 files changed, 13 insertions, 1 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 5b53fbe..3474251 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -929,6 +929,7 @@ Deprecated
* :mod:`ossaudiodev`
* :mod:`pipes`
* :mod:`sndhdr`
+ * :mod:`spwd`
(Contributed by Brett Cannon in :issue:`47061`.)
diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
index a143acc..50766c2 100644
--- a/Lib/test/test_spwd.py
+++ b/Lib/test/test_spwd.py
@@ -1,9 +1,12 @@
import os
import unittest
from test.support import import_helper
+import warnings
-spwd = import_helper.import_module('spwd')
+with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ spwd = import_helper.import_module('spwd')
@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
diff --git a/Misc/NEWS.d/next/Library/2022-04-17-12-32-40.gh-issue-91217.ms49Rg.rst b/Misc/NEWS.d/next/Library/2022-04-17-12-32-40.gh-issue-91217.ms49Rg.rst
new file mode 100644
index 0000000..9655522
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-04-17-12-32-40.gh-issue-91217.ms49Rg.rst
@@ -0,0 +1 @@
+Deprecate the spwd module.
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
index acea306..42123c9 100644
--- a/Modules/spwdmodule.c
+++ b/Modules/spwdmodule.c
@@ -256,5 +256,12 @@ static struct PyModuleDef spwdmodule = {
PyMODINIT_FUNC
PyInit_spwd(void)
{
+ if (PyErr_WarnEx(PyExc_DeprecationWarning,
+ "'spwd' is deprecated and slated for removal in "
+ "Python 3.13",
+ 7)) {
+ return NULL;
+ }
+
return PyModuleDef_Init(&spwdmodule);
}