With waitpid and WNOHANG, only check the first element of the tuple
since the second element may vary (bug #337465, comment #12).
diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py
index 0013d73..b2b19d5 100644
--- a/pym/_emerge/SubProcess.py
+++ b/pym/_emerge/SubProcess.py
@@ -25,6 +25,9 @@
 			return self.returncode
 
 		try:
+			# With waitpid and WNOHANG, only check the
+			# first element of the tuple since the second
+			# element may vary (bug #337465).
 			retval = os.waitpid(self.pid, os.WNOHANG)
 		except OSError as e:
 			if e.errno != errno.ECHILD:
@@ -32,7 +35,7 @@
 			del e
 			retval = (self.pid, 1)
 
-		if retval == (0, 0):
+		if retval[0] == 0:
 			return None
 		self._set_returncode(retval)
 		return self.returncode
@@ -81,6 +84,9 @@
 				return self.returncode
 
 		try:
+			# With waitpid and WNOHANG, only check the
+			# first element of the tuple since the second
+			# element may vary (bug #337465).
 			wait_retval = os.waitpid(self.pid, os.WNOHANG)
 		except OSError as e:
 			if e.errno != errno.ECHILD:
@@ -88,7 +94,7 @@
 			del e
 			self._set_returncode((self.pid, 1))
 		else:
-			if wait_retval != (0, 0):
+			if wait_retval[0] != 0:
 				self._set_returncode(wait_retval)
 			else:
 				try:
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index eb02a03..92eb18b 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2177,7 +2177,10 @@
 				except portage.exception.AlarmSignal:
 					# timed out
 					print('timed out')
-					if mypids and os.waitpid(mypids[0], os.WNOHANG) == (0,0):
+					# With waitpid and WNOHANG, only check the
+					# first element of the tuple since the second
+					# element may vary (bug #337465).
+					if mypids and os.waitpid(mypids[0], os.WNOHANG)[0] == 0:
 						os.kill(mypids[0], signal.SIGTERM)
 						os.waitpid(mypids[0], 0)
 					# This is the same code rsync uses for timeout.
diff --git a/pym/portage/process.py b/pym/portage/process.py
index 2787e08..37b482a 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -135,7 +135,10 @@
 	while spawned_pids:
 		pid = spawned_pids.pop()
 		try:
-			if os.waitpid(pid, os.WNOHANG) == (0, 0):
+			# With waitpid and WNOHANG, only check the
+			# first element of the tuple since the second
+			# element may vary (bug #337465).
+			if os.waitpid(pid, os.WNOHANG)[0] == 0:
 				os.kill(pid, signal.SIGTERM)
 				os.waitpid(pid, 0)
 		except OSError:
@@ -289,7 +292,10 @@
 			# If it failed, kill off anything else that
 			# isn't dead yet.
 			for pid in mypids:
-				if os.waitpid(pid, os.WNOHANG) == (0,0):
+				# With waitpid and WNOHANG, only check the
+				# first element of the tuple since the second
+				# element may vary (bug #337465).
+				if os.waitpid(pid, os.WNOHANG)[0] == 0:
 					os.kill(pid, signal.SIGTERM)
 					os.waitpid(pid, 0)
 				spawned_pids.remove(pid)