[Python-checkins] cpython: Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure

victor.stinner python-checkins at python.org
Thu Oct 31 17:23:59 CET 2013


http://hg.python.org/cpython/rev/8f58e57e0d59
changeset:   86806:8f58e57e0d59
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 31 16:35:38 2013 +0100
summary:
  Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure

files:
  Modules/_ssl.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -528,6 +528,10 @@
 
     self->socket_type = socket_type;
     self->Socket = PyWeakref_NewRef((PyObject *) sock, NULL);
+    if (self->Socket == NULL) {
+        Py_DECREF(self);
+        return NULL;
+    }
     return self;
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list