
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]
[0] https://github.com/DamlaAltun/cpython/tree/_iplike-socket [1] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [2] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [3] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [4] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [5] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [6] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [7] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [8] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [9] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94... [10] https://github.com/DamlaAltun/cpython/commit/d39a261edb91d6e423d319b1dd20f94...