diff --git a/Doc/library/nis.rst b/Doc/library/nis.rst deleted file mode 100644 index 3fa7916c37b..00000000000 --- a/Doc/library/nis.rst +++ /dev/null @@ -1,72 +0,0 @@ - -:mod:`nis` --- Interface to Sun's NIS (Yellow Pages) -==================================================== - -.. module:: nis - :platform: Unix - :synopsis: Interface to Sun's NIS (Yellow Pages) library. - :deprecated: - -.. moduleauthor:: Fred Gansevles -.. sectionauthor:: Moshe Zadka - -.. deprecated-removed:: 3.11 3.13 - The :mod:`nis` module is deprecated - (see :pep:`PEP 594 <594#nis>` for details). - --------------- - -The :mod:`nis` module gives a thin wrapper around the NIS library, useful for -central administration of several hosts. - -Because NIS exists only on Unix systems, this module is only available for Unix. - -.. include:: ../includes/wasm-notavail.rst - -The :mod:`nis` module defines the following functions: - - -.. function:: match(key, mapname, domain=default_domain) - - Return the match for *key* in map *mapname*, or raise an error - (:exc:`nis.error`) if there is none. Both should be strings, *key* is 8-bit - clean. Return value is an arbitrary array of bytes (may contain ``NULL`` and - other joys). - - Note that *mapname* is first checked if it is an alias to another name. - - The *domain* argument allows overriding the NIS domain used for the lookup. If - unspecified, lookup is in the default NIS domain. - - -.. function:: cat(mapname, domain=default_domain) - - Return a dictionary mapping *key* to *value* such that ``match(key, - mapname)==value``. Note that both keys and values of the dictionary are - arbitrary arrays of bytes. - - Note that *mapname* is first checked if it is an alias to another name. - - The *domain* argument allows overriding the NIS domain used for the lookup. If - unspecified, lookup is in the default NIS domain. - - -.. function:: maps(domain=default_domain) - - Return a list of all valid maps. - - The *domain* argument allows overriding the NIS domain used for the lookup. If - unspecified, lookup is in the default NIS domain. - - -.. function:: get_default_domain() - - Return the system default NIS domain. - - -The :mod:`nis` module defines the following exception: - -.. exception:: error - - An error raised when a NIS function returns an error code. - diff --git a/Doc/library/superseded.rst b/Doc/library/superseded.rst index 1e6042094af..f68eeb6babb 100644 --- a/Doc/library/superseded.rst +++ b/Doc/library/superseded.rst @@ -16,7 +16,6 @@ backwards compatibility. They have been superseded by other modules. crypt.rst imghdr.rst msilib.rst - nis.rst optparse.rst uu.rst xdrlib.rst diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index a679c7cfca9..e57631ab4c9 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1426,9 +1426,9 @@ complete list of changes, or look through the SVN logs for all the details. :file:`.msi` files and CAB files. Some support for reading the :file:`.msi` database is also included. (Contributed by Martin von Löwis.) -* The :mod:`nis` module now supports accessing domains other than the system - default domain by supplying a *domain* argument to the :func:`nis.match` and - :func:`nis.maps` functions. (Contributed by Ben Bell.) +* The :mod:`!nis` module now supports accessing domains other than the system + default domain by supplying a *domain* argument to the :func:`!nis.match` and + :func:`!nis.maps` functions. (Contributed by Ben Bell.) * The :mod:`operator` module's :func:`itemgetter` and :func:`attrgetter` functions now support multiple fields. A call such as diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 37463b65d84..94e8b3d39fe 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1733,7 +1733,7 @@ Modules +---------------------+---------------------+---------------------+---------------------+---------------------+ | :mod:`aifc` | :mod:`chunk` | :mod:`msilib` | :mod:`!pipes` | :mod:`!telnetlib` | +---------------------+---------------------+---------------------+---------------------+---------------------+ - | :mod:`audioop` | :mod:`crypt` | :mod:`nis` | :mod:`!sndhdr` | :mod:`uu` | + | :mod:`audioop` | :mod:`crypt` | :mod:`!nis` | :mod:`!sndhdr` | :mod:`uu` | +---------------------+---------------------+---------------------+---------------------+---------------------+ | :mod:`!cgi` | :mod:`imghdr` | :mod:`!nntplib` | :mod:`!spwd` | :mod:`xdrlib` | +---------------------+---------------------+---------------------+---------------------+---------------------+ diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 0a047fa0880..ccba6229f45 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -895,7 +895,7 @@ Modules (see :pep:`594`): * :mod:`imghdr` * :mod:`!mailcap` * :mod:`msilib` -* :mod:`nis` +* :mod:`!nis` * :mod:`!nntplib` * :mod:`!ossaudiodev` * :mod:`!pipes` diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 544171af2ef..a45294e183d 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -192,6 +192,9 @@ Removed instead. (Contributed by Victor Stinner in :gh:`104773`.) +* :pep:`594`: Remove the :mod:`!nis` module, deprecated in Python 3.11. + (Contributed by Victor Stinner in :gh:`104773`.) + Porting to Python 3.13 ====================== diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py deleted file mode 100644 index f327ecf3d1d..00000000000 --- a/Lib/test/test_nis.py +++ /dev/null @@ -1,43 +0,0 @@ -from test.support import import_helper -import unittest -import warnings - - -# Skip test if nis module does not exist. -with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - nis = import_helper.import_module('nis') - - -class NisTests(unittest.TestCase): - def test_maps(self): - try: - maps = nis.maps() - except nis.error as msg: - # NIS is probably not active, so this test isn't useful - self.skipTest(str(msg)) - try: - # On some systems, this map is only accessible to the - # super user - maps.remove("passwd.adjunct.byname") - except ValueError: - pass - - done = 0 - for nismap in maps: - mapping = nis.cat(nismap) - for k, v in mapping.items(): - if not k: - continue - if nis.match(k, nismap) != v: - self.fail("NIS match failed for key `%s' in map `%s'" % (k, nismap)) - else: - # just test the one key, otherwise this test could take a - # very long time - done = 1 - break - if done: - break - -if __name__ == '__main__': - unittest.main() diff --git a/Misc/NEWS.d/3.10.0a1.rst b/Misc/NEWS.d/3.10.0a1.rst index 47181166264..c7cd6507043 100644 --- a/Misc/NEWS.d/3.10.0a1.rst +++ b/Misc/NEWS.d/3.10.0a1.rst @@ -714,7 +714,7 @@ Fix refleak in _Py_fopen_obj() when PySys_Audit() fails .. nonce: tzMy7m .. section: Core and Builtins -Add a state to the :mod:`nis` module (:pep:`3121`) and apply the multiphase +Add a state to the :mod:`!nis` module (:pep:`3121`) and apply the multiphase initialization. Patch by Dong-hee Na. .. diff --git a/Misc/NEWS.d/next/Library/2023-05-24-23-40-22.gh-issue-104773.FHA99J.rst b/Misc/NEWS.d/next/Library/2023-05-24-23-40-22.gh-issue-104773.FHA99J.rst new file mode 100644 index 00000000000..96c315dda79 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-05-24-23-40-22.gh-issue-104773.FHA99J.rst @@ -0,0 +1,2 @@ +:pep:`594`: Remove the :mod:`!nis` module, deprecated in Python 3.11. Patch +by Victor Stinner. diff --git a/Modules/Setup b/Modules/Setup index 79a5124e31d..05d037bdca9 100644 --- a/Modules/Setup +++ b/Modules/Setup @@ -191,7 +191,6 @@ PYTHONPATH=$(COREPYTHONPATH) # Modules with UNIX dependencies that require external libraries #_crypt _cryptmodule.c -lcrypt -#nis nismodule.c -I/usr/include/tirpc -lnsl -ltirpc # Modules that require external libraries. diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index dbad7ba8b20..ef3c5644fd0 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -111,9 +111,6 @@ @MODULE_FCNTL_TRUE@fcntl fcntlmodule.c @MODULE_GRP_TRUE@grp grpmodule.c @MODULE_MMAP_TRUE@mmap mmapmodule.c -# FreeBSD: nis/yp APIs are in libc -# Linux: glibc has deprecated SUN RPC, APIs are in libnsl and libtirpc (bpo-32521) -@MODULE_NIS_TRUE@nis nismodule.c # needs sys/soundcard.h or linux/soundcard.h (Linux, FreeBSD) @MODULE__POSIXSUBPROCESS_TRUE@_posixsubprocess _posixsubprocess.c @MODULE_RESOURCE_TRUE@resource resource.c diff --git a/Modules/nismodule.c b/Modules/nismodule.c deleted file mode 100644 index 6d094490cea..00000000000 --- a/Modules/nismodule.c +++ /dev/null @@ -1,536 +0,0 @@ -/*********************************************************** - Written by: - Fred Gansevles - B&O group, - Faculteit der Informatica, - Universiteit Twente, - Enschede, - the Netherlands. -******************************************************************/ - -/* NIS module implementation */ - -#include "Python.h" - -#include // free() -#include -#include -#include -#include -#include - -#ifdef __sgi -/* This is missing from rpcsvc/ypclnt.h */ -extern int yp_get_default_domain(char **); -#endif - -PyDoc_STRVAR(get_default_domain__doc__, -"get_default_domain() -> str\n\ -Corresponds to the C library yp_get_default_domain() call, returning\n\ -the default NIS domain.\n"); - -PyDoc_STRVAR(match__doc__, -"match(key, map, domain = defaultdomain)\n\ -Corresponds to the C library yp_match() call, returning the value of\n\ -key in the given map. Optionally domain can be specified but it\n\ -defaults to the system default domain.\n"); - -PyDoc_STRVAR(cat__doc__, -"cat(map, domain = defaultdomain)\n\ -Returns the entire map as a dictionary. Optionally domain can be\n\ -specified but it defaults to the system default domain.\n"); - -PyDoc_STRVAR(maps__doc__, -"maps(domain = defaultdomain)\n\ -Returns an array of all available NIS maps within a domain. If domain\n\ -is not specified it defaults to the system default domain.\n"); - -typedef struct { - PyObject *nis_error; -} nis_state; - -static inline nis_state* -get_nis_state(PyObject *module) -{ - void *state = PyModule_GetState(module); - assert(state != NULL); - return (nis_state *)state; -} - -static int -nis_clear(PyObject *m) -{ - Py_CLEAR(get_nis_state(m)->nis_error); - return 0; -} - -static int -nis_traverse(PyObject *m, visitproc visit, void *arg) -{ - Py_VISIT(get_nis_state(m)->nis_error); - return 0; -} - -static void -nis_free(void *m) -{ - nis_clear((PyObject *) m); -} - -static PyObject * -nis_error(nis_state *state, int err) -{ - PyErr_SetString(state->nis_error, yperr_string(err)); - return NULL; -} - -static struct nis_map { - char *alias; - char *map; - int fix; -} aliases [] = { - {"passwd", "passwd.byname", 0}, - {"group", "group.byname", 0}, - {"networks", "networks.byaddr", 0}, - {"hosts", "hosts.byname", 0}, - {"protocols", "protocols.bynumber", 0}, - {"services", "services.byname", 0}, - {"aliases", "mail.aliases", 1}, /* created with 'makedbm -a' */ - {"ethers", "ethers.byname", 0}, - {0L, 0L, 0} -}; - -static char * -nis_mapname(char *map, int *pfix) -{ - int i; - - *pfix = 0; - for (i=0; aliases[i].alias != 0L; i++) { - if (!strcmp (aliases[i].alias, map) || !strcmp (aliases[i].map, map)) { - *pfix = aliases[i].fix; - return aliases[i].map; - } - } - - return map; -} - -#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) -typedef int (*foreachfunc)(unsigned long, char *, int, char *, int, void *); -#else -typedef int (*foreachfunc)(int, char *, int, char *, int, char *); -#endif - -struct ypcallback_data { - PyObject *dict; - int fix; - PyThreadState *state; -}; - -static int -nis_foreach(int instatus, char *inkey, int inkeylen, char *inval, - int invallen, struct ypcallback_data *indata) -{ - if (instatus == YP_TRUE) { - PyObject *key; - PyObject *val; - int err; - - PyEval_RestoreThread(indata->state); - if (indata->fix) { - if (inkeylen > 0 && inkey[inkeylen-1] == '\0') - inkeylen--; - if (invallen > 0 && inval[invallen-1] == '\0') - invallen--; - } - key = PyUnicode_DecodeFSDefaultAndSize(inkey, inkeylen); - val = PyUnicode_DecodeFSDefaultAndSize(inval, invallen); - if (key == NULL || val == NULL) { - /* XXX error -- don't know how to handle */ - PyErr_Clear(); - Py_XDECREF(key); - Py_XDECREF(val); - indata->state = PyEval_SaveThread(); - return 1; - } - err = PyDict_SetItem(indata->dict, key, val); - Py_DECREF(key); - Py_DECREF(val); - if (err != 0) - PyErr_Clear(); - indata->state = PyEval_SaveThread(); - if (err != 0) - return 1; - return 0; - } - return 1; -} - -static PyObject * -nis_get_default_domain(PyObject *module, PyObject *Py_UNUSED(ignored)) -{ - char *domain; - int err; - PyObject *res; - nis_state *state = get_nis_state(module); - if ((err = yp_get_default_domain(&domain)) != 0) { - return nis_error(state, err); - } - - res = PyUnicode_FromStringAndSize (domain, strlen(domain)); - return res; -} - -static PyObject * -nis_match(PyObject *module, PyObject *args, PyObject *kwdict) -{ - char *match; - char *domain = NULL; - Py_ssize_t keylen; - int len; - char *key, *map; - int err; - PyObject *ukey, *bkey, *res; - int fix; - static char *kwlist[] = {"key", "map", "domain", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, - "Us|s:match", kwlist, - &ukey, &map, &domain)) { - return NULL; - } - if ((bkey = PyUnicode_EncodeFSDefault(ukey)) == NULL) { - return NULL; - } - /* check for embedded null bytes */ - if (PyBytes_AsStringAndSize(bkey, &key, &keylen) == -1) { - Py_DECREF(bkey); - return NULL; - } - - nis_state *state = get_nis_state(module); - if (!domain && ((err = yp_get_default_domain(&domain)) != 0)) { - Py_DECREF(bkey); - return nis_error(state, err); - } - map = nis_mapname (map, &fix); - if (fix) - keylen++; - Py_BEGIN_ALLOW_THREADS - err = yp_match (domain, map, key, keylen, &match, &len); - Py_END_ALLOW_THREADS - Py_DECREF(bkey); - if (fix) - len--; - if (err != 0) { - return nis_error(state, err); - } - res = PyUnicode_DecodeFSDefaultAndSize(match, len); - free (match); - return res; -} - -static PyObject * -nis_cat(PyObject *module, PyObject *args, PyObject *kwdict) -{ - char *domain = NULL; - char *map; - struct ypall_callback cb; - struct ypcallback_data data; - PyObject *dict; - int err; - static char *kwlist[] = {"map", "domain", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "s|s:cat", - kwlist, &map, &domain)) { - return NULL; - } - nis_state *state = get_nis_state(module); - if (!domain && ((err = yp_get_default_domain(&domain)) != 0)) { - return nis_error(state, err); - } - dict = PyDict_New (); - if (dict == NULL) - return NULL; - cb.foreach = (foreachfunc)nis_foreach; - data.dict = dict; - map = nis_mapname (map, &data.fix); - cb.data = (char *)&data; - data.state = PyEval_SaveThread(); - err = yp_all (domain, map, &cb); - PyEval_RestoreThread(data.state); - if (err != 0) { - Py_DECREF(dict); - return nis_error(state, err); - } - return dict; -} - -/* These should be u_long on Sun h/w but not on 64-bit h/w. - This is not portable to machines with 16-bit ints and no prototypes */ -#ifndef YPPROC_MAPLIST -#define YPPROC_MAPLIST 11 -#endif -#ifndef YPPROG -#define YPPROG 100004 -#endif -#ifndef YPVERS -#define YPVERS 2 -#endif - -typedef char *domainname; -typedef char *mapname; - -enum nisstat { - NIS_TRUE = 1, - NIS_NOMORE = 2, - NIS_FALSE = 0, - NIS_NOMAP = -1, - NIS_NODOM = -2, - NIS_NOKEY = -3, - NIS_BADOP = -4, - NIS_BADDB = -5, - NIS_YPERR = -6, - NIS_BADARGS = -7, - NIS_VERS = -8 -}; -typedef enum nisstat nisstat; - -struct nismaplist { - mapname map; - struct nismaplist *next; -}; -typedef struct nismaplist nismaplist; - -struct nisresp_maplist { - nisstat stat; - nismaplist *maps; -}; -typedef struct nisresp_maplist nisresp_maplist; - -static struct timeval TIMEOUT = { 25, 0 }; - -static -bool_t -nis_xdr_domainname(XDR *xdrs, domainname *objp) -{ - if (!xdr_string(xdrs, objp, YPMAXDOMAIN)) { - return (FALSE); - } - return (TRUE); -} - -static -bool_t -nis_xdr_mapname(XDR *xdrs, mapname *objp) -{ - if (!xdr_string(xdrs, objp, YPMAXMAP)) { - return (FALSE); - } - return (TRUE); -} - -static -bool_t -nis_xdr_ypmaplist(XDR *xdrs, nismaplist *objp) -{ - if (!nis_xdr_mapname(xdrs, &objp->map)) { - return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->next, - sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) - { - return (FALSE); - } - return (TRUE); -} - -static -bool_t -nis_xdr_ypstat(XDR *xdrs, nisstat *objp) -{ - if (!xdr_enum(xdrs, (enum_t *)objp)) { - return (FALSE); - } - return (TRUE); -} - - -static -bool_t -nis_xdr_ypresp_maplist(XDR *xdrs, nisresp_maplist *objp) -{ - if (!nis_xdr_ypstat(xdrs, &objp->stat)) { - return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->maps, - sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) - { - return (FALSE); - } - return (TRUE); -} - - -static -nisresp_maplist * -nisproc_maplist_2(domainname *argp, CLIENT *clnt) -{ - static nisresp_maplist res; - - memset(&res, 0, sizeof(res)); - if (clnt_call(clnt, YPPROC_MAPLIST, - (xdrproc_t)nis_xdr_domainname, (caddr_t)argp, - (xdrproc_t)nis_xdr_ypresp_maplist, (caddr_t)&res, - TIMEOUT) != RPC_SUCCESS) - { - return (NULL); - } - return (&res); -} - -static -nismaplist * -nis_maplist(nis_state *state, char *dom) -{ - nisresp_maplist *list; - CLIENT *cl; - char *server = NULL; - int mapi = 0; - - while (!server && aliases[mapi].map != 0L) { - yp_master (dom, aliases[mapi].map, &server); - mapi++; - } - if (!server) { - PyErr_SetString(state->nis_error, "No NIS master found for any map"); - return NULL; - } - cl = clnt_create(server, YPPROG, YPVERS, "tcp"); - if (cl == NULL) { - PyErr_SetString(state->nis_error, clnt_spcreateerror(server)); - goto finally; - } - list = nisproc_maplist_2 (&dom, cl); - clnt_destroy(cl); - if (list == NULL) - goto finally; - if (list->stat != NIS_TRUE) - goto finally; - - free(server); - return list->maps; - - finally: - free(server); - return NULL; -} - -static PyObject * -nis_maps (PyObject *module, PyObject *args, PyObject *kwdict) -{ - char *domain = NULL; - nismaplist *maps; - PyObject *list; - int err; - static char *kwlist[] = {"domain", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, - "|s:maps", kwlist, &domain)) { - return NULL; - } - - nis_state *state = get_nis_state(module); - if (!domain && ((err = yp_get_default_domain (&domain)) != 0)) { - nis_error(state, err); - return NULL; - } - - if ((maps = nis_maplist(state, domain)) == NULL) { - return NULL; - } - if ((list = PyList_New(0)) == NULL) { - return NULL; - } - for (; maps; maps = maps->next) { - PyObject *str = PyUnicode_FromString(maps->map); - if (!str || PyList_Append(list, str) < 0) - { - Py_XDECREF(str); - Py_SETREF(list, NULL); - break; - } - Py_DECREF(str); - } - /* XXX Shouldn't we free the list of maps now? */ - return list; -} - -static PyMethodDef nis_methods[] = { - {"match", _PyCFunction_CAST(nis_match), - METH_VARARGS | METH_KEYWORDS, - match__doc__}, - {"cat", _PyCFunction_CAST(nis_cat), - METH_VARARGS | METH_KEYWORDS, - cat__doc__}, - {"maps", _PyCFunction_CAST(nis_maps), - METH_VARARGS | METH_KEYWORDS, - maps__doc__}, - {"get_default_domain", nis_get_default_domain, - METH_NOARGS, - get_default_domain__doc__}, - {NULL, NULL} /* Sentinel */ -}; - -static int -nis_exec(PyObject *module) -{ - nis_state* state = get_nis_state(module); - state->nis_error = PyErr_NewException("nis.error", NULL, NULL); - if (state->nis_error == NULL) { - return -1; - } - - Py_INCREF(state->nis_error); - if (PyModule_AddObject(module, "error", state->nis_error) < 0) { - Py_DECREF(state->nis_error); - return -1; - } - return 0; -} - -static PyModuleDef_Slot nis_slots[] = { - {Py_mod_exec, nis_exec}, - // XXX gh-103092: fix isolation. - {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, - //{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, - {0, NULL} -}; - -PyDoc_STRVAR(nis__doc__, -"This module contains functions for accessing NIS maps.\n"); - -static struct PyModuleDef nismodule = { - PyModuleDef_HEAD_INIT, - .m_name = "nis", - .m_doc = nis__doc__, - .m_size = sizeof(nis_state), - .m_methods = nis_methods, - .m_traverse = nis_traverse, - .m_clear = nis_clear, - .m_free = nis_free, - .m_slots = nis_slots, -}; - -PyMODINIT_FUNC -PyInit_nis(void) -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "'nis' is deprecated and slated for removal in " - "Python 3.13", - 7)) { - return NULL; - } - return PyModuleDef_Init(&nismodule); -} diff --git a/PC/pyconfig.h b/PC/pyconfig.h index f9250d6facc..ac20129cd30 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -675,9 +675,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ /* Define if you have the mpc library (-lmpc). */ /* #undef HAVE_LIBMPC */ -/* Define if you have the nsl library (-lnsl). */ -#define HAVE_LIBNSL 1 - /* Define if you have the seq library (-lseq). */ /* #undef HAVE_LIBSEQ */ diff --git a/Python/stdlib_module_names.h b/Python/stdlib_module_names.h index f27a80135b3..841eb956752 100644 --- a/Python/stdlib_module_names.h +++ b/Python/stdlib_module_names.h @@ -184,7 +184,6 @@ static const char* _Py_stdlib_module_names[] = { "msvcrt", "multiprocessing", "netrc", -"nis", "nt", "ntpath", "nturl2path", diff --git a/Tools/c-analyzer/cpython/_parser.py b/Tools/c-analyzer/cpython/_parser.py index 9bd54db0f59..04618c1814e 100644 --- a/Tools/c-analyzer/cpython/_parser.py +++ b/Tools/c-analyzer/cpython/_parser.py @@ -120,7 +120,6 @@ Objects/stringlib/*.h Objects # possible system-installed headers, just in case Modules/_tkinter.c /usr/include/tcl8.6 Modules/_uuidmodule.c /usr/include/uuid -Modules/nismodule.c /usr/include/tirpc Modules/tkappinit.c /usr/include/tcl # @end=tsv@ diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 3c58a32efff..7ca14b91c84 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -454,9 +454,6 @@ Modules/_tkinter.c - trbInCmd - ##----------------------- ## initialized once -## pre-allocated buffer -Modules/nismodule.c nisproc_maplist_2 res - - ## other Include/datetime.h - PyDateTimeAPI - Modules/_ctypes/cfield.c _ctypes_get_fielddesc initialized - diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv index f358f301a5b..5b08c74e1de 100644 --- a/Tools/c-analyzer/cpython/ignored.tsv +++ b/Tools/c-analyzer/cpython/ignored.tsv @@ -282,8 +282,6 @@ Modules/cmathmodule.c - tanh_special_values - Modules/config.c - _PyImport_Inittab - Modules/faulthandler.c - faulthandler_handlers - Modules/getnameinfo.c - gni_afdl - -Modules/nismodule.c - TIMEOUT - -Modules/nismodule.c - aliases - Modules/posixmodule.c os_getxattr_impl buffer_sizes - Modules/posixmodule.c os_listxattr_impl buffer_sizes - Modules/posixmodule.c - posix_constants_confstr - diff --git a/Tools/wasm/Setup.local.example b/Tools/wasm/Setup.local.example index cfb9f7fc875..ad58c31a2ef 100644 --- a/Tools/wasm/Setup.local.example +++ b/Tools/wasm/Setup.local.example @@ -5,7 +5,6 @@ audioop _bz2 _crypt _decimal -nis _pickle pyexpat _elementtree _sha3 _blake2 diff --git a/configure b/configure index 053e001925e..6b6cc090f77 100755 --- a/configure +++ b/configure @@ -666,8 +666,6 @@ MODULE__SQLITE3_FALSE MODULE__SQLITE3_TRUE MODULE_READLINE_FALSE MODULE_READLINE_TRUE -MODULE_NIS_FALSE -MODULE_NIS_TRUE MODULE__GDBM_FALSE MODULE__GDBM_TRUE MODULE__DBM_FALSE @@ -847,8 +845,6 @@ TCLTK_LIBS TCLTK_CFLAGS LIBSQLITE3_LIBS LIBSQLITE3_CFLAGS -LIBNSL_LIBS -LIBNSL_CFLAGS LIBMPDEC_INTERNAL LIBMPDEC_CFLAGS MODULE__CTYPES_MALLOC_CLOSURE @@ -1108,8 +1104,6 @@ LIBUUID_CFLAGS LIBUUID_LIBS LIBFFI_CFLAGS LIBFFI_LIBS -LIBNSL_CFLAGS -LIBNSL_LIBS LIBSQLITE3_CFLAGS LIBSQLITE3_LIBS TCLTK_CFLAGS @@ -1926,9 +1920,6 @@ Some influential environment variables: LIBFFI_CFLAGS C compiler flags for LIBFFI, overriding pkg-config LIBFFI_LIBS linker flags for LIBFFI, overriding pkg-config - LIBNSL_CFLAGS - C compiler flags for LIBNSL, overriding pkg-config - LIBNSL_LIBS linker flags for LIBNSL, overriding pkg-config LIBSQLITE3_CFLAGS C compiler flags for LIBSQLITE3, overriding pkg-config LIBSQLITE3_LIBS @@ -13217,275 +13208,6 @@ fi -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNSL" >&5 -$as_echo_n "checking for LIBNSL... " >&6; } - -if test -n "$LIBNSL_CFLAGS"; then - pkg_cv_LIBNSL_CFLAGS="$LIBNSL_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libnsl") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBNSL_CFLAGS=`$PKG_CONFIG --cflags "libnsl" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$LIBNSL_LIBS"; then - pkg_cv_LIBNSL_LIBS="$LIBNSL_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libnsl") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBNSL_LIBS=`$PKG_CONFIG --libs "libnsl" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - LIBNSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnsl" 2>&1` - else - LIBNSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnsl" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$LIBNSL_PKG_ERRORS" >&5 - - - LIBNSL_CFLAGS=${LIBNSL_CFLAGS-""} - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yp_match" >&5 -$as_echo_n "checking for library containing yp_match... " >&6; } -if ${ac_cv_search_yp_match+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char yp_match (); -int -main () -{ -return yp_match (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_yp_match=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_yp_match+:} false; then : - break -fi -done -if ${ac_cv_search_yp_match+:} false; then : - -else - ac_cv_search_yp_match=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_match" >&5 -$as_echo "$ac_cv_search_yp_match" >&6; } -ac_res=$ac_cv_search_yp_match -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - have_nis=yes -else - have_nis=no -fi - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - case $ac_cv_search_yp_match in #( - no) : - libnsl="" ;; #( - "none required") : - libnsl="" ;; #( - *) : - libnsl="$ac_cv_search_yp_match" - ;; -esac - LIBNSL_LIBS=${LIBNSL_LIBS-$libnsl} - -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - LIBNSL_CFLAGS=${LIBNSL_CFLAGS-""} - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yp_match" >&5 -$as_echo_n "checking for library containing yp_match... " >&6; } -if ${ac_cv_search_yp_match+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char yp_match (); -int -main () -{ -return yp_match (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_yp_match=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_yp_match+:} false; then : - break -fi -done -if ${ac_cv_search_yp_match+:} false; then : - -else - ac_cv_search_yp_match=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_match" >&5 -$as_echo "$ac_cv_search_yp_match" >&6; } -ac_res=$ac_cv_search_yp_match -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - have_nis=yes -else - have_nis=no -fi - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - case $ac_cv_search_yp_match in #( - no) : - libnsl="" ;; #( - "none required") : - libnsl="" ;; #( - *) : - libnsl="$ac_cv_search_yp_match" - ;; -esac - LIBNSL_LIBS=${LIBNSL_LIBS-$libnsl} - -else - LIBNSL_CFLAGS=$pkg_cv_LIBNSL_CFLAGS - LIBNSL_LIBS=$pkg_cv_LIBNSL_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_nis=yes -fi - -if test "x$have_nis" = xyes; then : - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - CPPFLAGS="$CPPFLAGS $LIBNSL_CFLAGS" - for ac_header in rpc/rpc.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "rpc/rpc.h" "ac_cv_header_rpc_rpc_h" "$ac_includes_default" -if test "x$ac_cv_header_rpc_rpc_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_RPC_RPC_H 1 -_ACEOF - -fi - -done - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - -fi - - if test "$ac_sys_system" = "Emscripten" -a -z "$LIBSQLITE3_CFLAGS" -a -z "$LIBSQLITE3_LIBS"; then : @@ -25662,13 +25384,11 @@ case $ac_sys_system in #( py_cv_module__scproxy=n/a - py_cv_module_nis=n/a ;; #( QNX*) : py_cv_module__scproxy=n/a - py_cv_module_nis=n/a ;; #( FreeBSD*) : @@ -25691,7 +25411,6 @@ case $ac_sys_system in #( py_cv_module__xxsubinterpreters=n/a py_cv_module__xxinterpchannels=n/a py_cv_module_grp=n/a - py_cv_module_nis=n/a py_cv_module_pwd=n/a py_cv_module_resource=n/a py_cv_module_syslog=n/a @@ -27293,40 +27012,6 @@ fi $as_echo "$py_cv_module__gdbm" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module nis" >&5 -$as_echo_n "checking for stdlib extension module nis... " >&6; } - if test "$py_cv_module_nis" != "n/a"; then : - - if true; then : - if test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes; then : - py_cv_module_nis=yes -else - py_cv_module_nis=missing -fi -else - py_cv_module_nis=disabled -fi - -fi - as_fn_append MODULE_BLOCK "MODULE_NIS_STATE=$py_cv_module_nis$as_nl" - if test "x$py_cv_module_nis" = xyes; then : - - as_fn_append MODULE_BLOCK "MODULE_NIS_CFLAGS=$LIBNSL_CFLAGS$as_nl" - as_fn_append MODULE_BLOCK "MODULE_NIS_LDFLAGS=$LIBNSL_LIBS$as_nl" - -fi - if test "$py_cv_module_nis" = yes; then - MODULE_NIS_TRUE= - MODULE_NIS_FALSE='#' -else - MODULE_NIS_TRUE='#' - MODULE_NIS_FALSE= -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_nis" >&5 -$as_echo "$py_cv_module_nis" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module readline" >&5 $as_echo_n "checking for stdlib extension module readline... " >&6; } if test "$py_cv_module_readline" != "n/a"; then : @@ -28387,10 +28072,6 @@ if test -z "${MODULE__GDBM_TRUE}" && test -z "${MODULE__GDBM_FALSE}"; then as_fn_error $? "conditional \"MODULE__GDBM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE_NIS_TRUE}" && test -z "${MODULE_NIS_FALSE}"; then - as_fn_error $? "conditional \"MODULE_NIS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE_READLINE_TRUE}" && test -z "${MODULE_READLINE_FALSE}"; then as_fn_error $? "conditional \"MODULE_READLINE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 325df16a5b8..536deb975a3 100644 --- a/configure.ac +++ b/configure.ac @@ -3894,28 +3894,6 @@ if test "$have_glibc_memmove_bug" = yes; then fi -dnl check for NIS / libnsl dependencies -dnl libnsl dependencies include tirpc includes and lib -PKG_CHECK_MODULES([LIBNSL], [libnsl], [have_nis=yes], [ - LIBNSL_CFLAGS=${LIBNSL_CFLAGS-""} - WITH_SAVE_ENV([ - AC_SEARCH_LIBS([yp_match], [nsl], [have_nis=yes], [have_nis=no]) - ]) - AS_CASE([$ac_cv_search_yp_match], - [no], [libnsl=""], - ["none required"], [libnsl=""], - [libnsl="$ac_cv_search_yp_match"] - ) - LIBNSL_LIBS=${LIBNSL_LIBS-$libnsl} -]) - -AS_VAR_IF([have_nis], [yes], [ - WITH_SAVE_ENV([ - CPPFLAGS="$CPPFLAGS $LIBNSL_CFLAGS" - AC_CHECK_HEADERS([rpc/rpc.h]) - ]) -]) - dnl detect sqlite3 from Emscripten emport PY_CHECK_EMSCRIPTEN_PORT([LIBSQLITE3], [-sUSE_SQLITE3]) @@ -7086,8 +7064,8 @@ dnl VxWorks does not provide crypt() function AS_CASE([$ac_sys_system], [AIX], [PY_STDLIB_MOD_SET_NA([_scproxy])], [VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [_crypt], [termios], [grp])], - [CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])], - [QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])], + [CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy])], + [QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy])], [FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy])], [Emscripten|WASI], [ dnl subprocess and multiprocessing are not supported (no fork syscall). @@ -7108,7 +7086,6 @@ AS_CASE([$ac_sys_system], [_xxsubinterpreters], [_xxinterpchannels], [grp], - [nis], [pwd], [resource], [syslog], @@ -7313,9 +7290,6 @@ PY_STDLIB_MOD([_dbm], PY_STDLIB_MOD([_gdbm], [test "$have_gdbm_dbmliborder" = yes], [test "$have_gdbm" = yes], [$GDBM_CFLAGS], [$GDBM_LIBS]) -PY_STDLIB_MOD([nis], - [], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes], - [$LIBNSL_CFLAGS], [$LIBNSL_LIBS]) PY_STDLIB_MOD([readline], [], [test "$with_readline" != "no"], [$READLINE_CFLAGS], [$READLINE_LIBS]) diff --git a/pyconfig.h.in b/pyconfig.h.in index 2c22b27af65..46b3448b404 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1004,9 +1004,6 @@ /* Define if you have readline 4.0 */ #undef HAVE_RL_RESIZE_TERMINAL -/* Define to 1 if you have the header file. */ -#undef HAVE_RPC_RPC_H - /* Define to 1 if you have the `rtpSpawn' function. */ #undef HAVE_RTPSPAWN