Armin Rigo  committed b944b80 Merge

hg merge default (reported by marienz on irc)

  • Participants
  • Parent commits cc9629f, 519e061
  • Branches release-1.9.x

Comments (0)

Files changed (3)

File lib-python/2.7/

             # else tmp is empty, and we're done
     def save_dict(self, obj):
-        modict_saver = self._pickle_moduledict(obj)
+        modict_saver = self._pickle_maybe_moduledict(obj)
         if modict_saver is not None:
             return self.save_reduce(*modict_saver)
             # else tmp is empty, and we're done
-    def _pickle_moduledict(self, obj):
+    def _pickle_maybe_moduledict(self, obj):
         # save module dictionary as "getattr(module, '__dict__')"
+        try:
+            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:
+                return None
+        except (AttributeError, KeyError, TypeError):
+            return None
-        # build index of module dictionaries
-        try:
-            modict = self.module_dict_ids
-        except AttributeError:
-            modict = {}
-            from sys import modules
-            for mod in modules.values():
-                if isinstance(mod, ModuleType):
-                    modict[id(mod.__dict__)] = mod
-            self.module_dict_ids = modict
-        thisid = id(obj)
-        try:
-            themodule = modict[thisid]
-        except KeyError:
-            return None
-        from __builtin__ import getattr
         return getattr, (themodule, '__dict__')

File pypy/doc/coding-guide.rst

     >>>> cPickle.__file__
-    >>>> import opcode
-    >>>> opcode.__file__
-    '/home/hpk/pypy-dist/lib-python/modified-2.7/'
     >>>> import os
     >>>> os.__file__
     contains pure Python reimplementation of modules.
-    The files and tests that we have modified from the CPython library.
-    The unmodified CPython library. **Never ever check anything in there**.
+    The modified CPython library.
 .. _`modify modules`:
 by default and CPython has a number of places where it relies
 on some classes being old-style.
-If you want to change a module or test contained in ``lib-python/2.7``
-then make sure that you copy the file to our ``lib-python/modified-2.7``
-directory first.  In mercurial commandline terms this reads::
-    $ hg cp lib-python/2.7/ lib-python/modified-2.7/
-and subsequently you edit and commit
-``lib-python/modified-2.7/``.  This copying operation is
-important because it keeps the original CPython tree clean and makes it
-obvious what we had to change.
+We just maintain those changes in place,
+to see what is changed we have a branch called `vendot/stdlib`
+wich contains the unmodified cpython stdlib
 .. _`mixed module mechanism`:
 .. _`mixed modules`:

File pypy/doc/getting-started-python.rst

-   ./lib-python/modified-2.7
 The hierarchy shown above is relative to a PREFIX directory.  PREFIX is