[pypy-commit] pypy release-1.9.x: hg merge default (reported by marienz on irc)
arigo
noreply at buildbot.pypy.org
Wed Jun 6 11:45:23 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: release-1.9.x
Changeset: r55428:b944b80e5266
Date: 2012-06-06 11:45 +0200
http://bitbucket.org/pypy/pypy/changeset/b944b80e5266/
Log: hg merge default (reported by marienz on irc)
diff --git a/lib-python/2.7/pickle.py b/lib-python/2.7/pickle.py
--- a/lib-python/2.7/pickle.py
+++ b/lib-python/2.7/pickle.py
@@ -638,7 +638,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)
@@ -691,26 +691,20 @@
write(SETITEM)
# 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__')
diff --git a/pypy/doc/coding-guide.rst b/pypy/doc/coding-guide.rst
--- a/pypy/doc/coding-guide.rst
+++ b/pypy/doc/coding-guide.rst
@@ -610,10 +610,6 @@
>>>> cPickle.__file__
'/home/hpk/pypy-dist/lib_pypy/cPickle..py'
- >>>> import opcode
- >>>> opcode.__file__
- '/home/hpk/pypy-dist/lib-python/modified-2.7/opcode.py'
-
>>>> import os
>>>> os.__file__
'/home/hpk/pypy-dist/lib-python/2.7/os.py'
@@ -639,13 +635,9 @@
contains pure Python reimplementation of modules.
-*lib-python/modified-2.7/*
-
- The files and tests that we have modified from the CPython library.
-
*lib-python/2.7/*
- The unmodified CPython library. **Never ever check anything in there**.
+ The modified CPython library.
.. _`modify modules`:
@@ -658,16 +650,9 @@
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/somemodule.py lib-python/modified-2.7/
-
-and subsequently you edit and commit
-``lib-python/modified-2.7/somemodule.py``. 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`:
diff --git a/pypy/doc/getting-started-python.rst b/pypy/doc/getting-started-python.rst
--- a/pypy/doc/getting-started-python.rst
+++ b/pypy/doc/getting-started-python.rst
@@ -220,7 +220,6 @@
./include/
./lib_pypy/
./lib-python/2.7
- ./lib-python/modified-2.7
./site-packages/
The hierarchy shown above is relative to a PREFIX directory. PREFIX is
More information about the pypy-commit
mailing list