@@ -6528,30 +6528,29 @@ _socket_socket_inet_aton_impl(PySocketSockObject *self, const char *ip_addr)
6528
6528
}
6529
6529
6530
6530
#ifdef HAVE_INET_NTOA
6531
- PyDoc_STRVAR ( inet_ntoa_doc ,
6532
- " inet_ntoa(packed_ip) -> ip_address_string\n\
6533
- \n\
6534
- Convert an IP address from 32-bit packed binary format to string format" );
6531
+ /*[clinic input]
6532
+ _socket.socket. inet_ntoa
6533
+ packed_ip: Py_buffer
6534
+ /
6535
6535
6536
- static PyObject *
6537
- socket_inet_ntoa (PyObject * self , PyObject * args )
6536
+ Convert an IP address from 32-bit packed binary format to string format.
6537
+ [clinic start generated code]*/
6538
+
6539
+ static PyObject *
6540
+ _socket_socket_inet_ntoa_impl (PySocketSockObject * self , Py_buffer * packed_ip )
6541
+ /*[clinic end generated code: output=b671880a3f62461b input=95c2c4a1b2ee957c]*/
6538
6542
{
6539
- Py_buffer packed_ip ;
6540
6543
struct in_addr packed_addr ;
6541
6544
6542
- if (!PyArg_ParseTuple (args , "y*:inet_ntoa" , & packed_ip )) {
6543
- return NULL ;
6544
- }
6545
-
6546
- if (packed_ip .len != sizeof (packed_addr )) {
6545
+ if (packed_ip -> len != sizeof (packed_addr )) {
6547
6546
PyErr_SetString (PyExc_OSError ,
6548
6547
"packed IP wrong length for inet_ntoa" );
6549
- PyBuffer_Release (& packed_ip );
6548
+ PyBuffer_Release (packed_ip );
6550
6549
return NULL ;
6551
6550
}
6552
6551
6553
- memcpy (& packed_addr , packed_ip . buf , packed_ip . len );
6554
- PyBuffer_Release (& packed_ip );
6552
+ memcpy (& packed_addr , packed_ip -> buf , packed_ip -> len );
6553
+ PyBuffer_Release (packed_ip );
6555
6554
6556
6555
SUPPRESS_DEPRECATED_CALL
6557
6556
return PyUnicode_FromString (inet_ntoa (packed_addr ));
@@ -7219,8 +7218,7 @@ static PyMethodDef socket_methods[] = {
7219
7218
METH_O , htonl_doc },
7220
7219
_SOCKET_SOCKET_INET_ATON_METHODDEF
7221
7220
#ifdef HAVE_INET_NTOA
7222
- {"inet_ntoa ", socket_inet_ntoa ,
7223
- METH_VARARGS , inet_ntoa_doc },
7221
+ _SOCKET_SOCKET_INET_NTOA_METHODDEF
7224
7222
#endif
7225
7223
#ifdef HAVE_INET_PTON
7226
7224
{"inet_pton ", socket_inet_pton ,
0 commit comments