[pypy-commit] pypy py3k: merge default

pjenvey noreply at buildbot.pypy.org
Thu Apr 10 20:36:21 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r70541:ec295dbad48a
Date: 2014-04-10 11:35 -0700
http://bitbucket.org/pypy/pypy/changeset/ec295dbad48a/

Log:	merge default

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -215,7 +215,7 @@
                    "make instances really small but slow without the JIT",
                    default=False,
                    requires=[("objspace.std.getattributeshortcut", True),
-                             ("objspace.std.withmethodcache", True),
+                             ("objspace.std.withtypeversion", True),
                        ]),
 
         BoolOption("withliststrategies",
diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst
--- a/pypy/doc/cpython_differences.rst
+++ b/pypy/doc/cpython_differences.rst
@@ -315,6 +315,15 @@
   implementation detail that shows up because of internal C-level slots
   that PyPy does not have.
 
+* on CPython, ``[].__add__`` is a ``method-wrapper``, and
+  ``list.__add__`` is a ``slot wrapper``.  On PyPy these are normal
+  bound or unbound method objects.  This can occasionally confuse some
+  tools that inspect built-in types.  For example, the standard
+  library ``inspect`` module has a function ``ismethod()`` that returns
+  True on unbound method objects but False on method-wrappers or slot
+  wrappers.  On PyPy we can't tell the difference, so
+  ``ismethod([].__add__) == ismethod(list.__add__) == True``.
+
 * the ``__dict__`` attribute of new-style classes returns a normal dict, as
   opposed to a dict proxy like in CPython. Mutating the dict will change the
   type and vice versa. For builtin types, a dictionary will be returned that
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -586,6 +586,10 @@
             return self.len - self.pos
         return 0
 
+    def _cleanup_(self):
+        raise Exception("seeing a prebuilt %r object" % (
+            self.__class__,))
+
 class BaseKeyIterator(BaseIteratorImplementation):
     next_key = _new_next('key')
 
@@ -1099,6 +1103,10 @@
         w_ret = space.newtuple([new_inst, space.newtuple([w_res])])
         return w_ret
 
+    def _cleanup_(self):
+        raise Exception("seeing a prebuilt %r object" % (
+            self.__class__,))
+
 
 class W_DictMultiIterKeysObject(W_BaseDictMultiIterObject):
     def descr_next(self, space):
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -871,8 +871,7 @@
             name = space.str_w(w_name)
             # We need to care for obscure cases in which the w_descr is
             # a TypeCell, which may change without changing the version_tag
-            assert space.config.objspace.std.withmethodcache
-            _, w_descr = w_type._pure_lookup_where_with_method_cache(
+            _, w_descr = w_type._pure_lookup_where_possibly_with_method_cache(
                 name, version_tag)
             #
             selector = ("", INVALID)
@@ -930,9 +929,8 @@
     # in the class, this time taking care of the result: it can be either a
     # quasi-constant class attribute, or actually a TypeCell --- which we
     # must not cache.  (It should not be None here, but you never know...)
-    assert space.config.objspace.std.withmethodcache
-    _, w_method = w_type._pure_lookup_where_with_method_cache(name,
-                                                              version_tag)
+    _, w_method = w_type._pure_lookup_where_possibly_with_method_cache(
+        name, version_tag)
     if w_method is None or isinstance(w_method, TypeCell):
         return
     _fill_cache(pycode, nameindex, map, version_tag, -1, w_method)
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -369,6 +369,12 @@
         w_class, w_value = w_self._pure_lookup_where_with_method_cache(name, version_tag)
         return w_class, unwrap_cell(space, w_value)
 
+    def _pure_lookup_where_possibly_with_method_cache(w_self, name, version_tag):
+        if w_self.space.config.objspace.std.withmethodcache:
+            return w_self._pure_lookup_where_with_method_cache(name, version_tag)
+        else:
+            return w_self._lookup_where_all_typeobjects(name)
+
     @elidable
     def _pure_lookup_where_with_method_cache(w_self, name, version_tag):
         space = w_self.space
diff --git a/rpython/jit/backend/x86/support.py b/rpython/jit/backend/x86/support.py
--- a/rpython/jit/backend/x86/support.py
+++ b/rpython/jit/backend/x86/support.py
@@ -7,11 +7,12 @@
     extra = ['-DPYPY_X86_CHECK_SSE2']
     if sys.platform != 'win32':
         extra += ['-msse2', '-mfpmath=sse']
+    else:
+        extra += ['/arch:SSE2']
 else:
     extra = []    # the -m options above are always on by default on x86-64
 
-if sys.platform != 'win32':
-    extra = ['-DPYPY_CPU_HAS_STANDARD_PRECISION'] + extra
+extra = ['-DPYPY_CPU_HAS_STANDARD_PRECISION'] + extra
 
 ensure_sse2_floats = rffi.llexternal_use_eci(ExternalCompilationInfo(
     compile_extra = extra,


More information about the pypy-commit mailing list