summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2022-04-23 21:48:17 (GMT)
committerGitHub <noreply@github.com>2022-04-23 21:48:17 (GMT)
commit692e9078a10b268530f8da7d3095cfb05c48435b (patch)
treea56ddd66970808ab1721dc57f6c07cd5d838f70a
parent28890427c58d30f1041b36859733159475c67496 (diff)
downloadcpython-692e9078a10b268530f8da7d3095cfb05c48435b.zip
cpython-692e9078a10b268530f8da7d3095cfb05c48435b.tar.gz
cpython-692e9078a10b268530f8da7d3095cfb05c48435b.tar.bz2
gh-91217: deprecate spwd (#91846)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
-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);
}