Commits

Armin Rigo committed 519e061

Be even more careful.

Comments (0)

Files changed (1)

lib-python/2.7/pickle.py

     def _pickle_maybe_moduledict(self, obj):
         # save module dictionary as "getattr(module, '__dict__')"
         try:
-            themodule = sys.modules[obj['__name__']]
+            name = obj['__name__']
+            if type(name) is not str:
+                return None
+            themodule = sys.modules[name]
             if type(themodule) is not ModuleType:
                 return None
             if themodule.__dict__ is not obj: