From: Zac Medico Date: Thu, 9 Feb 2006 03:44:58 +0000 (-0000) Subject: use getattr instead of hasattr for detection of base class destructor (recommended... X-Git-Tag: v2.1_pre5_2760~65 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1d32856c808e1b52ff762efe24955e4d865293b6;p=portage.git use getattr instead of hasattr for detection of base class destructor (recommended by marienz) svn path=/main/trunk/; revision=2685 --- diff --git a/pym/portage_util.py b/pym/portage_util.py index c796ef0a2..c8d55fcdd 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -527,9 +527,9 @@ class atomic_ofstream(file): if not self.closed: self.abort() # ensure destructor from the base class is called - base_self = super(atomic_ofstream, self) - if hasattr(base_self, "__del__"): - base_self.__del__() + base_destructor = getattr(super(atomic_ofstream, self), '__del__', None) + if base_destructor is not None: + base_destructor() def write_atomic(file_path, content): f = atomic_ofstream(file_path)