]> granicus.if.org Git - python/commitdiff
Merged revisions 87140 via svnmerge from
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Thu, 9 Dec 2010 12:30:05 +0000 (12:30 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Thu, 9 Dec 2010 12:30:05 +0000 (12:30 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87140 | hirokazu.yamamoto | 2010-12-09 19:49:00 +0900 (木, 09 12 2010) | 2 lines

  Should call Py_INCREF for Py_None (Modules/_ssl.c: PySSL_cipher)
........

Modules/_ssl.c

index d4e550ecf473c3e7f33328dbc245ce2e15cc19f8..73a76bbc0586f1a9e9e0d656918018dcdc9ef9c2 100644 (file)
@@ -1047,10 +1047,10 @@ static PyObject *PySSL_cipher (PySSLObject *self) {
     char *cipher_protocol;
 
     if (self->ssl == NULL)
-        return Py_None;
+        Py_RETURN_NONE;
     current = SSL_get_current_cipher(self->ssl);
     if (current == NULL)
-        return Py_None;
+        Py_RETURN_NONE;
 
     retval = PyTuple_New(3);
     if (retval == NULL)
@@ -1058,6 +1058,7 @@ static PyObject *PySSL_cipher (PySSLObject *self) {
 
     cipher_name = (char *) SSL_CIPHER_get_name(current);
     if (cipher_name == NULL) {
+        Py_INCREF(Py_None);
         PyTuple_SET_ITEM(retval, 0, Py_None);
     } else {
         v = PyUnicode_FromString(cipher_name);
@@ -1067,6 +1068,7 @@ static PyObject *PySSL_cipher (PySSLObject *self) {
     }
     cipher_protocol = SSL_CIPHER_get_version(current);
     if (cipher_protocol == NULL) {
+        Py_INCREF(Py_None);
         PyTuple_SET_ITEM(retval, 1, Py_None);
     } else {
         v = PyUnicode_FromString(cipher_protocol);