X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fvalue.py;fp=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fvalue.py;h=2710d90330c8fa0849e055713d569fc8cf9f591f;hb=b5947615bfcd6a309e1945a270f67ccc6cd2cf69;hp=b6a5a4a1efc1c588b491836e162137e61daf4c77;hpb=056632bfab2b876e4e6149eaa3a6889ca3d28533;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/value.py b/src/bindings/python/bt2/bt2/value.py index b6a5a4a1..2710d903 100644 --- a/src/bindings/python/bt2/bt2/value.py +++ b/src/bindings/python/bt2/bt2/value.py @@ -30,7 +30,14 @@ import bt2 def _create_from_ptr(ptr): - if ptr is None or ptr == native_bt.value_null: + if ptr is None: + return + + # bt_value_null is translated to None. However, we are given a reference + # to it that we are not going to manage anymore, since we don't create a + # Python wrapper for it. Therefore put that reference immediately. + if ptr == native_bt.value_null: + bt2.value._Value._put_ref(ptr) return typeid = native_bt.value_get_type(ptr)