diff -r 376091a4ad23 -r b7dbe957585c mercurial/util.py --- a/mercurial/util.py Mon Jul 25 16:02:42 2011 -0500 +++ b/mercurial/util.py Mon Jul 25 16:04:40 2011 -0500 @@ -358,8 +358,8 @@ The code supports py2exe (most common, Windows only) and tools/freeze (portable, not much used). """ - return (hasattr(sys, "frozen") or # new py2exe - hasattr(sys, "importers") or # old py2exe + return (safehasattr(sys, "frozen") or # new py2exe + safehasattr(sys, "importers") or # old py2exe imp.is_frozen("__main__")) # tools/freeze def hgexecutable(): @@ -783,7 +783,7 @@ self._fp.close() def __del__(self): - if hasattr(self, '_fp'): # constructor actually did something + if safehasattr(self, '_fp'): # constructor actually did something self.close() def makedirs(name, mode=None): @@ -1254,8 +1254,9 @@ def handler(signum, frame): terminated.add(os.wait()) prevhandler = None - if hasattr(signal, 'SIGCHLD'): - prevhandler = signal.signal(signal.SIGCHLD, handler) + SIGCHLD = getattr(signal, 'SIGCHLD', None) + if SIGCHLD is not None: + prevhandler = signal.signal(SIGCHLD, handler) try: pid = spawndetached(args) while not condfn():