Closes #19071: "self" argument is not the module for module functions in 2.x.
make _socket.socket weakrefable (closes #22569)

Patch from Alex Gaynor.