[pypy-commit] pypy default: merge
fijal
noreply at buildbot.pypy.org
Wed Jun 8 09:46:56 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r44828:fadf0f6402fa
Date: 2011-06-08 09:47 +0200
http://bitbucket.org/pypy/pypy/changeset/fadf0f6402fa/
Log: merge
diff --git a/pypy/module/__builtin__/__init__.py b/pypy/module/__builtin__/__init__.py
--- a/pypy/module/__builtin__/__init__.py
+++ b/pypy/module/__builtin__/__init__.py
@@ -31,6 +31,8 @@
'apply' : 'app_functional.apply',
'sorted' : 'app_functional.sorted',
+ 'any' : 'app_functional.any',
+ 'all' : 'app_functional.all',
'vars' : 'app_inspect.vars',
'dir' : 'app_inspect.dir',
@@ -95,8 +97,6 @@
'range' : 'functional.range_int',
'xrange' : 'functional.W_XRange',
'enumerate' : 'functional.W_Enumerate',
- 'all' : 'functional.all',
- 'any' : 'functional.any',
'min' : 'functional.min',
'max' : 'functional.max',
'sum' : 'functional.sum',
diff --git a/pypy/module/__builtin__/app_functional.py b/pypy/module/__builtin__/app_functional.py
--- a/pypy/module/__builtin__/app_functional.py
+++ b/pypy/module/__builtin__/app_functional.py
@@ -16,3 +16,21 @@
sorted_lst = list(lst)
sorted_lst.sort(cmp, key, reverse)
return sorted_lst
+
+def any(seq):
+ """any(iterable) -> bool
+
+Return True if bool(x) is True for any x in the iterable."""
+ for x in seq:
+ if x:
+ return True
+ return False
+
+def all(seq):
+ """all(iterable) -> bool
+
+Return True if bool(x) is True for all values x in the iterable."""
+ for x in seq:
+ if not x:
+ return False
+ return True
diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py
--- a/pypy/module/__builtin__/functional.py
+++ b/pypy/module/__builtin__/functional.py
@@ -452,40 +452,6 @@
w_empty = space.call_function(w_str_type)
return space.call_method(w_empty, "join", space.newlist(result_w))
-def all(space, w_S):
- """all(iterable) -> bool
-
-Return True if bool(x) is True for all values x in the iterable."""
- w_iter = space.iter(w_S)
- while True:
- try:
- w_next = space.next(w_iter)
- except OperationError, e:
- if not e.match(space, space.w_StopIteration):
- raise # re-raise other app-level exceptions
- break
- if not space.is_true(w_next):
- return space.w_False
- return space.w_True
-
-
-def any(space, w_S):
- """any(iterable) -> bool
-
-Return True if bool(x) is True for any x in the iterable."""
- w_iter = space.iter(w_S)
- while True:
- try:
- w_next = space.next(w_iter)
- except OperationError, e:
- if not e.match(space, space.w_StopIteration):
- raise # re-raise other app-level exceptions
- break
- if space.is_true(w_next):
- return space.w_True
- return space.w_False
-
-
class W_Enumerate(Wrappable):
def __init__(self, w_iter, w_start):
diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -16,6 +16,7 @@
from pypy.interpreter.baseobjspace import ObjSpace, W_Root
from opcode import opmap
from pypy.rlib.objectmodel import we_are_translated
+from pypy.rlib.nonconst import NonConstant
PyFrame._virtualizable2_ = ['last_instr', 'pycode',
'valuestackdepth', 'valuestack_w[*]',
@@ -199,9 +200,10 @@
return space.call_args(w_callable, __args__)
class Cache(object):
+ in_recursion = False
+
def __init__(self, space):
self.w_compile_hook = space.w_None
- self.in_recursion = False
@unwrap_spec(ObjSpace, W_Root)
def set_compile_hook(space, w_hook):
@@ -226,4 +228,5 @@
"""
cache = space.fromcache(Cache)
cache.w_compile_hook = w_hook
+ cache.in_recursion = NonConstant(False)
return space.w_None
More information about the pypy-commit
mailing list