bindings: try importing collections.abc first for forward compatibility
[babeltrace.git] / bindings / python / babeltrace / babeltrace.i.in
index a773e9b37379899dbf597117976f774221c126de..8eec1c1d1e7864ea1a6aa21063d0b50a90fb1aed 100644 (file)
@@ -672,8 +672,11 @@ class CTFScope:
 _scopes = [CTFScope.EVENT_FIELDS, CTFScope.EVENT_CONTEXT, CTFScope.STREAM_EVENT_CONTEXT,
        CTFScope.STREAM_EVENT_HEADER, CTFScope.STREAM_PACKET_CONTEXT, CTFScope.TRACE_PACKET_HEADER]
 
 _scopes = [CTFScope.EVENT_FIELDS, CTFScope.EVENT_CONTEXT, CTFScope.STREAM_EVENT_CONTEXT,
        CTFScope.STREAM_EVENT_HEADER, CTFScope.STREAM_PACKET_CONTEXT, CTFScope.TRACE_PACKET_HEADER]
 
-import collections
-class Event(collections.Mapping):
+try:
+       import collections.abc as collections_abc
+except ImportError:
+       import collections as collections_abc  # Fallback for Python 3.2
+class Event(collections_abc.Mapping):
        """
        This class represents an event from the trace.
        It is obtained using the TraceCollection generator functions.
        """
        This class represents an event from the trace.
        It is obtained using the TraceCollection generator functions.
This page took 0.022888 seconds and 4 git commands to generate.