@@ -7044,18 +7044,23 @@ PyDoc_STRVAR(if_nameindex_doc,
7044
7044
\n\
7045
7045
Returns a list of network interface information (index, name) tuples." );
7046
7046
7047
+ /*[clinic input]
7048
+ _socket.socket.if_nametoindex
7049
+ oname: object(converter="PyUnicode_FSConverter")
7050
+ /
7051
+
7052
+ Returns the interface index corresponding to the interface name if_name.
7053
+ [clinic start generated code]*/
7054
+
7047
7055
static PyObject *
7048
- socket_if_nametoindex (PyObject * self , PyObject * args )
7056
+ _socket_socket_if_nametoindex_impl (PySocketSockObject * self , PyObject * oname )
7057
+ /*[clinic end generated code: output=f7fc00511a309a8e input=662688054482cd46]*/
7049
7058
{
7050
- PyObject * oname ;
7051
7059
#ifdef MS_WINDOWS
7052
7060
NET_IFINDEX index ;
7053
7061
#else
7054
7062
unsigned long index ;
7055
7063
#endif
7056
- if (!PyArg_ParseTuple (args , "O&:if_nametoindex" ,
7057
- PyUnicode_FSConverter , & oname ))
7058
- return NULL ;
7059
7064
7060
7065
index = if_nametoindex (PyBytes_AS_STRING (oname ));
7061
7066
Py_DECREF (oname );
@@ -7068,10 +7073,6 @@ socket_if_nametoindex(PyObject *self, PyObject *args)
7068
7073
return PyLong_FromUnsignedLong (index );
7069
7074
}
7070
7075
7071
- PyDoc_STRVAR (if_nametoindex_doc ,
7072
- "if_nametoindex(if_name)\n\
7073
- \n\
7074
- Returns the interface index corresponding to the interface name if_name." );
7075
7076
7076
7077
static PyObject *
7077
7078
socket_if_indextoname (PyObject * self , PyObject * arg )
@@ -7241,8 +7242,7 @@ static PyMethodDef socket_methods[] = {
7241
7242
#if defined(HAVE_IF_NAMEINDEX ) || defined(MS_WINDOWS )
7242
7243
{"if_nameindex ", socket_if_nameindex ,
7243
7244
METH_NOARGS , if_nameindex_doc },
7244
- {"if_nametoindex ", socket_if_nametoindex ,
7245
- METH_VARARGS , if_nametoindex_doc },
7245
+ _SOCKET_SOCKET_IF_NAMETOINDEX_METHODDEF
7246
7246
{"if_indextoname ", socket_if_indextoname ,
7247
7247
METH_O , if_indextoname_doc },
7248
7248
#endif
0 commit comments