python: Ensure reference counts are properly incremented
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 3 May 2021 02:42:10 +0000 (14:42 +1200)
committerJeremy Allison <jra@samba.org>
Wed, 19 May 2021 01:32:34 +0000 (01:32 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/talloc/pytalloc.c
libgpo/pygpo.c
source4/auth/gensec/pygensec.c
source4/librpc/ndr/py_security.c
source4/ntvfs/posix/python/pyposix_eadb.c
source4/ntvfs/posix/python/pyxattr_native.c
source4/ntvfs/posix/python/pyxattr_tdb.c

index 15e4232f0c85aa73c5452ad12bf350eee01e4fd2..41decc45f613750d3e5a9315ab7f481190fba6a6 100644 (file)
@@ -41,7 +41,7 @@ static PyObject *pytalloc_report_full(PyObject *self, PyObject *args)
        } else {
                talloc_report_full(pytalloc_get_mem_ctx(py_obj), stdout);
        }
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
 /* enable null tracking */
@@ -49,7 +49,7 @@ static PyObject *pytalloc_enable_null_tracking(PyObject *self,
                PyObject *Py_UNUSED(ignored))
 {
        talloc_enable_null_tracking();
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
 /* return the number of talloc blocks */
index c527143ec7047c29409413c24504716f95e98aca..b5ec85a48d41258a0c400f0c8b6578ffc46fd4f3 100644 (file)
@@ -41,7 +41,7 @@ static PyObject* GPO_get_##ATTR(PyObject *self, void *closure) \
        if (gpo_ptr->ATTR) \
                return PyUnicode_FromString(gpo_ptr->ATTR); \
        else \
-               return Py_None; \
+               Py_RETURN_NONE; \
 }
 GPO_getter(ds_path)
 GPO_getter(file_sys_path)
index 568fc7c8db75863a8f7fa1123e4947f26a5eea32..490fcbecd5804357d324031ca08af5233fe8f195 100644 (file)
@@ -426,9 +426,9 @@ static PyObject *py_gensec_have_feature(PyObject *self, PyObject *args)
                return NULL;
 
        if (gensec_have_feature(security, feature)) {
-               return Py_True;
+               Py_RETURN_TRUE;
        } 
-       return Py_False;
+       Py_RETURN_FALSE;
 }
 
 static PyObject *py_gensec_set_max_update_size(PyObject *self, PyObject *args)
index f3cc9d13a7f4129a6ab5ee811fef4c9fec3b27ee..b5531d5830433cd9e717fd6e5a535330a5f9264d 100644 (file)
@@ -342,7 +342,7 @@ static PyObject *py_descriptor_richcmp(
                break;
        }
 
-       return Py_NotImplemented;
+       Py_RETURN_NOTIMPLEMENTED;
 }
 
 static void py_descriptor_patch(PyTypeObject *type)
index c64a388bfc72e54b7bc218212f29ef4f183db638..abf397f990c2a61d1a38bd4d2f5f3a19941d1028 100644 (file)
@@ -32,7 +32,7 @@
 static PyObject *py_is_xattr_supported(PyObject *self,
                        PyObject *Py_UNUSED(ignored))
 {
-       return Py_True;
+       Py_RETURN_TRUE;
 }
 
 static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
index 3be896911f21ea1f22a03530686a307da23cbd69..d242cd98a5d6484eb526c430516b69791c80fc58 100644 (file)
@@ -29,9 +29,9 @@ static PyObject *py_is_xattr_supported(PyObject *self,
                PyObject *Py_UNUSED(ignored))
 {
 #if !defined(HAVE_XATTR_SUPPORT)
-       return Py_False;
+       Py_RETURN_FALSE;
 #else
-       return Py_True;
+       Py_RETURN_TRUE;
 #endif
 }
 
index b457c86e066e45a88b3f83766be84d7ad43e3bce..425fd868ca02f73a77905ddc9f864860f99dde46 100644 (file)
@@ -36,7 +36,7 @@
 static PyObject *py_is_xattr_supported(PyObject *self,
                PyObject *Py_UNUSED(ignored))
 {
-       return Py_True;
+       Py_RETURN_TRUE;
 }
 
 static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)