I followed your instructions and appended them to the last commit of DamlaAltun/cpython (branch: _iplike-socket)[0] .
- Bytes and Integer support removed, only allowed string and IPLike. If string passed in it returns without any func call / modification. [1]
- IPLike moved to socket [2]
- `get_ipaddr()` renamed as `_ipaddr` and moved to socket. [3]
- IPLike & ipaddr() tests moved to test_socket [4]
- Created a header (ipaddrmodule.h) file and imported into Python.h and added header files list in
makefile.pre.in [5]
- In socketmodule.c;
- Created `PySocket_IPAddr(PyObject *address)[6], its behavior exactly same with socket._ipaddr's behavior. In Lib/socket.py it checks builtins for ipaddr method if it can not find it it renames _ipaddr as ipaddr [7].
- Created `socket_ipaddr_impl(PyObject *module, PyObject *address) [8], it used for exporting c method to python [9]. It calls PySocket_IPAddr.
- Added IPLike objects support to socket's idna_converter [10]