Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 23712:28b9971f068f 2.2
Backport:
The tp_new implementation should initialize the errorhandler field,
otherwise this code could segfault:
from socket import socket
s = socket.__new__(socket)
s.recv(100)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 06 Jun 2002 20:10:16 +0000 |
| parents | 37435f9f04d6 |
| children | 2b1219a72efc |
line wrap: on
line diff
--- a/Modules/socketmodule.c Thu Jun 06 17:55:35 2002 +0000 +++ b/Modules/socketmodule.c Thu Jun 06 20:10:16 2002 +0000 @@ -1800,8 +1800,10 @@ PyObject *new; new = type->tp_alloc(type, 0); - if (new != NULL) + if (new != NULL) { ((PySocketSockObject *)new)->sock_fd = -1; + ((PySocketSockObject *)new)->errorhandler = &PySocket_Err; + } return new; }
