diff options
| author | Guido van Rossum <guido@python.org> | 2002-06-06 20:10:16 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2002-06-06 20:10:16 (GMT) |
| commit | 93f2edba15da3ec98e4f7a7964400466e97b52c8 (patch) | |
| tree | 42b658bdf2be44d0e3c0db879db3d9879fac6835 /Modules/socketmodule.c | |
| parent | 56b36cdca14b10bc95a7840993dffa0eae4029cc (diff) | |
| download | cpython-93f2edba15da3ec98e4f7a7964400466e97b52c8.zip cpython-93f2edba15da3ec98e4f7a7964400466e97b52c8.tar.gz cpython-93f2edba15da3ec98e4f7a7964400466e97b52c8.tar.bz2 | |
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)
Diffstat (limited to 'Modules/socketmodule.c')
| -rw-r--r-- | Modules/socketmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 47ddcd5..172a507 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1800,8 +1800,10 @@ PySocketSock_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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; } |
