# Breakpoint 3, socket_getaddrinfo (self=self@entry=0xb705c034, args=args@entry=0xb71650c4, # kwargs=kwargs@entry=0x0) at /home/p/cpython-tip/Modules/socketmodule.c:5487 # 5487 { # ... # 5513 idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna"); # (gdb) # 5514 if (!idna) # (gdb) print *idna # $3 = {_ob_next = 0xb7241934, _ob_prev = 0xb70c86b8, ob_refcnt = 2, # ob_type = 0x82d1ac0 } # (gdb) n # 5516 assert(PyBytes_Check(idna)); # (gdb) # # Program received signal SIGABRT, Aborted. # 0xb77a6d4c in __kernel_vsyscall () # # "host" argument can be set to a subclass of unicode with a custom "encode" # method. "encode" returns unexpected type. assert is not compiled in release # mode, so this will lead to a type confusion later on. import socket as so class H(type("s")): def encode(self, x): return 666 h = H() so.getaddrinfo(host=h, port=1337)