# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+import abc
+
+
class _BaseObject:
# Ensure that the object always has _ptr set, even if it throws during
# construction.
return int(self._ptr)
def __repr__(self):
- return '<{}.{} object @ {}>'.format(
+ return "<{}.{} object @ {}>".format(
self.__class__.__module__, self.__class__.__name__, hex(self.addr)
)
# Python object that owns a reference to a Babeltrace object.
-class _SharedObject(_BaseObject):
-
+class _SharedObject(_BaseObject, abc.ABC):
# Get a new reference on ptr.
#
# This must be implemented by subclasses to work correctly with a pointer
# of the native type they wrap.
@staticmethod
+ @abc.abstractmethod
def _get_ref(ptr):
raise NotImplementedError
# of the native type they wrap.
@staticmethod
+ @abc.abstractmethod
def _put_ref(ptr):
raise NotImplementedError