From 16d4a807e169dc14bda09a928a617bd5d98d11f0 Mon Sep 17 00:00:00 2001 From: Stephen Herbein Date: Sun, 1 Dec 2019 15:56:45 -0800 Subject: [PATCH] bindings/python: rename Wrapper._clear() Allow future.pimpl._clear() to be called from other parts of the binding by dropping an underscore from its prefix. The _clear method has some extra protections to ensure the C destructor is only called once, thus future.pimpl._clear() is the preferred way to explicitly dispose of a future. This is a prereq for explicit cleanup of futures in the job() class. Originally proposed in #2553. --- src/bindings/python/flux/wrapper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bindings/python/flux/wrapper.py b/src/bindings/python/flux/wrapper.py index 4a58e7f1289b..a74d090f5c5b 100644 --- a/src/bindings/python/flux/wrapper.py +++ b/src/bindings/python/flux/wrapper.py @@ -326,7 +326,7 @@ def __getattr__(self, name): setattr(self, name, new_method) return new_method - def __clear(self): + def _clear(self): # avoid recursion if hasattr(self, "_handle") and self._handle is not None: handle = self._handle @@ -354,14 +354,14 @@ def handle(self, h): ) ) if self._handle is not None: - self.__clear() + self._clear() self._handle = h def __del__(self): - self.__clear() + self._clear() def __enter__(self): return self def __exit__(self, type_arg, value, unused): - self.__clear() + self._clear()