1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

python:tests: Fix crashing pymessaging tests

Commit 8c75d9fc73 changed
Messaging.deregister() to take a two‐element tuple containing private
data as well as a callback, but it did not change the call in
samba.tests.messaging.MessagingTests.test_register to match.

Since imessaging_deregister() completely ignored the ‘private_data’
parameter passed to it (assuming the callback was registered with
msg_type == -1), everything still appeared to work — until commit
b22c217995 changed Messaging.deregister()
to no longer leak memory. Now the wrong variable had its reference count
decremented, causing the test to crash.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-11-14 12:34:01 +13:00 committed by Andrew Bartlett
parent ec3e420840
commit beff3e6d77

View File

@ -39,9 +39,10 @@ class MessagingTests(TestCase):
def callback():
pass
msg_type = x.register((callback, None))
callback_and_context = (callback, None)
msg_type = x.register(callback_and_context)
self.assertTrue(isinstance(msg_type, int))
x.deregister(callback, msg_type)
x.deregister(callback_and_context, msg_type)
def test_all_servers(self):
x = self.get_context()