[Asterisk-code-review] lib/python/asterisk/pcap: Fix regression introduced by 345bd... (testsuite[master])
Anonymous Coward
asteriskteam at digium.com
Tue Nov 24 12:43:18 CST 2015
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: lib/python/asterisk/pcap: Fix regression introduced by 345bd86237
......................................................................
lib/python/asterisk/pcap: Fix regression introduced by 345bd86237
When 345bd86237 was merged, it assumed that using 'super' to call the base
class initializers would call all instances of that initializer in the
various base classes. Not surprisingly, this isn't how 'super' works at all.
Rather, 'super' guarantees proper method resolution order based on the
appearance of a base class type in the instance's __bases__ attribute. In this
case, because VOIPSniffer implemented __init__, and it appeared prior to
PcapListener in VOIPListener's __bases__, PcapListener was never being
initialized.
Since VOIPListener is a little odd in that it is composing these two types
together, it really does want to explicitly call the __init__ method on
the base types explicitly. As such, this patch changes the usage of 'super'
to use the explicit syntax. With this patch, both base classes have their
initialization methods called, and the various failing tests that still use
a pcap based listener pass again.
Multiple inheritance: proceed with extreme caution.
Change-Id: Ic6b47c505c3f4e73ab120cbcd71d1a8628ca4492
---
M lib/python/asterisk/pcap.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/lib/python/asterisk/pcap.py b/lib/python/asterisk/pcap.py
index 43dd91e..1523e9d 100644
--- a/lib/python/asterisk/pcap.py
+++ b/lib/python/asterisk/pcap.py
@@ -835,8 +835,9 @@
"""
if not 'register-observer' in module_config:
raise Exception('VOIPListener needs register-observer to be set')
+ VOIPSniffer.__init__(self, module_config, test_object)
+ PcapListener.__init__(self, module_config, test_object)
- super(VOIPListener, self).__init__(module_config, test_object)
def pcap_callback(self, packet):
"""Packet capture callback function
--
To view, visit https://gerrit.asterisk.org/1703
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic6b47c505c3f4e73ab120cbcd71d1a8628ca4492
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list