summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-14 12:44:56 (GMT)
committerGitHub <noreply@github.com>2022-11-14 12:44:56 (GMT)
commitc340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8 (patch)
tree2fa984d78bf3aa7e8c713f33c7ffdd6ed5817eb4 /Modules/_ssl
parent9a7e9f9921804f3f90151ca42703e612697dd430 (diff)
downloadcpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.zip
cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.tar.gz
cpython-c340cbb7f74bc99eaf72d6a4ef5b4d504d8519c8.tar.bz2
gh-99300: Use Py_NewRef() in Modules/ directory (#99468)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
Diffstat (limited to 'Modules/_ssl')
-rw-r--r--Modules/_ssl/debughelpers.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/_ssl/debughelpers.c b/Modules/_ssl/debughelpers.c
index 03c125e..08f3457 100644
--- a/Modules/_ssl/debughelpers.c
+++ b/Modules/_ssl/debughelpers.c
@@ -87,8 +87,7 @@ _PySSL_msg_callback(int write_p, int version, int content_type,
static PyObject *
_PySSLContext_get_msg_callback(PySSLContext *self, void *c) {
if (self->msg_cb != NULL) {
- Py_INCREF(self->msg_cb);
- return self->msg_cb;
+ return Py_NewRef(self->msg_cb);
} else {
Py_RETURN_NONE;
}
@@ -107,8 +106,7 @@ _PySSLContext_set_msg_callback(PySSLContext *self, PyObject *arg, void *c) {
"not a callable object");
return -1;
}
- Py_INCREF(arg);
- self->msg_cb = arg;
+ self->msg_cb = Py_NewRef(arg);
SSL_CTX_set_msg_callback(self->ctx, _PySSL_msg_callback);
}
return 0;
@@ -166,8 +164,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
static PyObject *
_PySSLContext_get_keylog_filename(PySSLContext *self, void *c) {
if (self->keylog_filename != NULL) {
- Py_INCREF(self->keylog_filename);
- return self->keylog_filename;
+ return Py_NewRef(self->keylog_filename);
} else {
Py_RETURN_NONE;
}
@@ -203,8 +200,7 @@ _PySSLContext_set_keylog_filename(PySSLContext *self, PyObject *arg, void *c) {
"Can't malloc memory for keylog file");
return -1;
}
- Py_INCREF(arg);
- self->keylog_filename = arg;
+ self->keylog_filename = Py_NewRef(arg);
/* Write a header for seekable, empty files (this excludes pipes). */
PySSL_BEGIN_ALLOW_THREADS