summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2010-12-09 10:49:00 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2010-12-09 10:49:00 (GMT)
commit524f10359b4a3ed8e15bef6a65bbc8bd4bee9cda (patch)
tree12fd873d993da0c319c4802fe57111ea30a9cf1a
parente239d23e8cc66605f548585ad4489a8f12fc070d (diff)
downloadcpython-524f10359b4a3ed8e15bef6a65bbc8bd4bee9cda.zip
cpython-524f10359b4a3ed8e15bef6a65bbc8bd4bee9cda.tar.gz
cpython-524f10359b4a3ed8e15bef6a65bbc8bd4bee9cda.tar.bz2
Should call Py_INCREF for Py_None (Modules/_ssl.c: PySSL_cipher)
-rw-r--r--Modules/_ssl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index a514555..1e4b38a 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -928,10 +928,10 @@ static PyObject *PySSL_cipher (PySSLSocket *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)
@@ -939,6 +939,7 @@ static PyObject *PySSL_cipher (PySSLSocket *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);
@@ -948,6 +949,7 @@ static PyObject *PySSL_cipher (PySSLSocket *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);