mirror of https://github.com/python/cpython
gh-91217: deprecate spwd (#91846)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
parent
28890427c5
commit
692e9078a1
|
@ -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`.)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import import_helper
|
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,
|
@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Deprecate the spwd module.
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue