public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10432 - main/branches/2.1.2/bin
@ 2008-05-26 23:05 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-05-26 23:05 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-05-26 23:05:46 +0000 (Mon, 26 May 2008)
New Revision: 10432

Modified:
   main/branches/2.1.2/bin/emerge
Log:
Avoid triggering "cPickle.UnpicklingError: Global and instance pickles
are not supported." errors that are triggered when the pickle contains
custom classes. (trunk r10431)


Modified: main/branches/2.1.2/bin/emerge
===================================================================
--- main/branches/2.1.2/bin/emerge	2008-05-26 23:03:35 UTC (rev 10431)
+++ main/branches/2.1.2/bin/emerge	2008-05-26 23:05:46 UTC (rev 10432)
@@ -1586,7 +1586,7 @@
 				if not isinstance(counter, (int, long)):
 					invalid_items.add(k)
 					continue
-				if not isinstance(atoms, list):
+				if not isinstance(atoms, (list, tuple)):
 					invalid_items.add(k)
 					continue
 				invalid_atom = False
@@ -1653,7 +1653,7 @@
 		@type blocker_data: BlockerData
 		"""
 		self._cache_data["blockers"][cpv] = \
-			(blocker_data.counter, blocker_data.atoms)
+			(blocker_data.counter, tuple(str(x) for x in blocker_data.atoms))
 		self._modified = True
 
 	def __iter__(self):
@@ -8408,7 +8408,17 @@
 			# XXX: Stored as a list for backward compatibility.
 			mtimedb["resume"]["myopts"] = \
 				[k for k in myopts if myopts[k] is True]
-			mtimedb["resume"]["favorites"]=favorites
+
+			# Convert Atom instances to plain str since the mtimedb loader
+			# sets unpickler.find_global = None which causes unpickler.load()
+			# to raise the following exception:
+			#
+			# cPickle.UnpicklingError: Global and instance pickles are not supported.
+			#
+			# TODO: Maybe stop setting find_global = None, or find some other
+			# way to avoid accidental triggering of the above UnpicklingError.
+			mtimedb["resume"]["favorites"] = [str(x) for x in favorites]
+
 			if ("--digest" in myopts) and not ("--fetchonly" in myopts or "--fetch-all-uri" in myopts):
 				for pkgline in mydepgraph.altlist():
 					if pkgline[0]=="ebuild" and pkgline[3]=="merge":

-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-26 23:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-26 23:05 [gentoo-commits] portage r10432 - main/branches/2.1.2/bin Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox