gh-91217: deprecate spwd (#91846)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
Brett Cannon 2022-04-23 14:48:17 -07:00 committed by GitHub
parent 28890427c5
commit 692e9078a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -929,6 +929,7 @@ Deprecated
* :mod:`ossaudiodev` * :mod:`ossaudiodev`
* :mod:`pipes` * :mod:`pipes`
* :mod:`sndhdr` * :mod:`sndhdr`
* :mod:`spwd`
(Contributed by Brett Cannon in :issue:`47061`.) (Contributed by Brett Cannon in :issue:`47061`.)

View File

@ -1,8 +1,11 @@
import os import os
import unittest import unittest
from test.support import import_helper from test.support import import_helper
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
spwd = import_helper.import_module('spwd') spwd = import_helper.import_module('spwd')

View File

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

View File

@ -256,5 +256,12 @@ static struct PyModuleDef spwdmodule = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit_spwd(void) 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); return PyModuleDef_Init(&spwdmodule);
} }