[pypy-svn] pypy arm-backend-2: merge default

bivab commits-noreply at bitbucket.org
Wed Feb 2 13:50:42 CET 2011


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r41559:903857f83c41
Date: 2011-02-02 13:48 +0100
http://bitbucket.org/pypy/pypy/changeset/903857f83c41/

Log:	merge default

diff --git a/pypy/module/__builtin__/app_file_stub.py b/pypy/module/__builtin__/app_file_stub.py
deleted file mode 100644
--- a/pypy/module/__builtin__/app_file_stub.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# NOT_RPYTHON
-
-class file(object): 
-    """file(name[, mode[, buffering]]) -> file object
-
-Open a file.  The mode can be 'r', 'w' or 'a' for reading (default),
-writing or appending.  The file will be created if it doesn't exist
-when opened for writing or appending; it will be truncated when
-opened for writing.  Add a 'b' to the mode for binary files.
-Add a '+' to the mode to allow simultaneous reading and writing.
-If the buffering argument is given, 0 means unbuffered, 1 means line
-buffered, and larger numbers specify the buffer size.
-Add a 'U' to mode to open the file for input with universal newline
-support.  Any line ending in the input file will be seen as a '\n'
-in Python.  Also, a file so opened gains the attribute 'newlines';
-the value for this attribute is one of None (no newline read yet),
-'\r', '\n', '\r\n' or a tuple containing all the newline types seen.
-
-Note:  open() is an alias for file().
-"""

diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -112,7 +112,7 @@
                w_locals=None, w_fromlist=None, level=-1):
     modulename = name
     space.timer.start_name("importhook", modulename)
-    if not modulename and level < 0: 
+    if not modulename and level < 0:
         raise OperationError(
             space.w_ValueError,
             space.wrap("Empty module name"))
@@ -305,7 +305,14 @@
             else:
                 break
         if w_importer is None:
-            w_importer = space.wrap(W_NullImporter(space))
+            try:
+                w_importer = space.call_function(
+                    space.gettypefor(W_NullImporter), w_pathitem
+                )
+            except OperationError, e:
+                if e.match(space, space.w_ImportError):
+                    return
+                raise
         if space.is_true(w_importer):
             space.setitem(w_path_importer_cache, w_pathitem, w_importer)
     if space.is_true(w_importer):
@@ -822,7 +829,7 @@
 
 def read_compiled_module(space, cpathname, strbuf):
     """ Read a code object from a file and check it for validity """
-    
+
     w_marshal = space.getbuiltinmodule('marshal')
     w_code = space.call_method(w_marshal, 'loads', space.wrap(strbuf))
     pycode = space.interpclass_w(w_code)
@@ -909,4 +916,3 @@
             os.unlink(cpathname)
         except OSError:
             pass
-

diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -501,6 +501,27 @@
         iterable = {}
         raises(TypeError, len, iter(iterable))
 
+    def test_missing(self):
+        class X(dict):
+            def __missing__(self, x):
+                assert x == 'hi'
+                return 42
+        assert X()['hi'] == 42
+
+    def test_missing_more(self):
+        def missing(self, x):
+            assert x == 'hi'
+            return 42
+        class SpecialDescr(object):
+            def __init__(self, impl):
+                self.impl = impl
+            def __get__(self, obj, owner):
+                return self.impl.__get__(obj, owner)
+        class X(dict):
+            __missing__ = SpecialDescr(missing)
+        assert X()['hi'] == 42
+
+
 class AppTest_DictMultiObject(AppTest_DictObject):
 
     def test_emptydict_unhashable(self):

diff --git a/pypy/translator/c/src/signals.h b/pypy/translator/c/src/signals.h
--- a/pypy/translator/c/src/signals.h
+++ b/pypy/translator/c/src/signals.h
@@ -119,7 +119,7 @@
 
     if (wakeup_fd != -1) 
       {
-        write(wakeup_fd, "\0", 1);
+        ssize_t res = write(wakeup_fd, "\0", 1);
         /* the return value is ignored here */
       }
 }

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
@@ -90,7 +90,7 @@
             w_missing = space.lookup(w_dict, "__missing__")
             if w_missing is None:
                 return None
-            return space.call_function(w_missing, w_dict, w_key)
+            return space.get_and_call_function(w_missing, w_dict, w_key)
         else:
             return None
 

diff --git a/pypy/module/pypyjit/policy.py b/pypy/module/pypyjit/policy.py
--- a/pypy/module/pypyjit/policy.py
+++ b/pypy/module/pypyjit/policy.py
@@ -13,14 +13,15 @@
         if '.' in modname:
             modname, _ = modname.split('.', 1)
         if modname in ['pypyjit', 'signal', 'micronumpy', 'math', 'exceptions',
-                       'imp', 'sys', 'array', '_ffi', 'itertools', 'operator']:
+                       'imp', 'sys', 'array', '_ffi', 'itertools', 'operator',
+                       '_socket']:
             return True
         return False
 
     def look_inside_function(self, func):
         mod = func.__module__ or '?'
 
-        if mod == 'pypy.rlib.rbigint' or mod == 'pypy.rlib.rlocale':
+        if mod == 'pypy.rlib.rbigint' or mod == 'pypy.rlib.rlocale' or mod == 'pypy.rlib.rsocket':
             return False
         if '_geninterp_' in func.func_globals: # skip all geninterped stuff
             return False

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -92,6 +92,7 @@
     "bz2"       : ["pypy.module.bz2.interp_bz2"],
     "pyexpat"   : ["pypy.module.pyexpat.interp_pyexpat"],
     "_ssl"      : ["pypy.module._ssl.interp_ssl"],
+    "_hashlib"  : ["pypy.module._ssl.interp_ssl"],
     "_minimal_curses": ["pypy.module._minimal_curses.fficurses"],
     }
 
@@ -165,7 +166,7 @@
                suggests=[("objspace.allworkingmodules", False)]),
 
     BoolOption("geninterp", "specify whether geninterp should be used",
-               default=True),
+               default=False),
 
     BoolOption("logbytecodes",
                "keep track of bytecode usage",


More information about the Pypy-commit mailing list