Author: Antonio Cuni <[email protected]>
Branch: improve-str2charp
Changeset: r65302:cf4e3cb3bd79
Date: 2013-07-09 21:32 +0200
http://bitbucket.org/pypy/pypy/changeset/cf4e3cb3bd79/
Log: merge default
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -2,9 +2,9 @@
=======
Except when otherwise stated (look for LICENSE files in directories or
-information at the beginning of each file) all software and
-documentation in the 'pypy', 'ctype_configure', 'dotviewer', 'demo',
-and 'lib_pypy' directories is licensed as follows:
+information at the beginning of each file) all software and documentation in
+the 'rpython', 'pypy', 'ctype_configure', 'dotviewer', 'demo', and 'lib_pypy'
+directories is licensed as follows:
The MIT License
diff --git a/pypy/doc/release-2.1.0-beta1.rst b/pypy/doc/release-2.1.0-beta1.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-2.1.0-beta1.rst
@@ -0,0 +1,66 @@
+===============
+PyPy 2.1 beta 1
+===============
+
+We're pleased to announce the first beta of the upcoming 2.1 release of PyPy.
+This beta contains many bugfixes and improvements, numerous improvements to the
+numpy in pypy effort. The main feature being that the ARM processor support is
+not longer considered alpha level. We would like to thank the `Raspberry Pi
+Foundation`_ for supporting the work to finish PyPy's ARM support.
+
+You can download the PyPy 2.1 beta 1 release here:
+
+ http://pypy.org/download.html
+
+.. _`Raspberry Pi Foundation`: http://www.raspberrypi.org
+
+Highlights
+==========
+
+* Bugfixes to the ARM JIT backend, so that ARM is now an officially
+ supported processor architecture.
+
+* Various numpy improvements.
+
+* Bugfixes to cffi and ctypes.
+
+* Bugfixes to the stacklet support
+
+* Improved logging performance
+
+What is PyPy?
+=============
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7.3. It's fast due to its integrated tracing JIT compiler.
+
+This release supports x86 machines running Linux 32/64, Mac OS X 64 or Windows
+32. Also this release supports ARM machines running Linux 32bit - anything with
+``ARMv6`` (like the Raspberry Pi) or ``ARMv7`` (like Beagleboard,
+Chromebook, Cubieboard, etc.) that supports ``VFPv3`` should work. Both
+hard-float ``armhf/gnueabihf`` and soft-float ``armel/gnueabi`` builds are
+provided. ``armhf`` builds for Raspbian are created using the Raspberry Pi
+`custom cross-compilation toolchain <https://github.com/raspberrypi>`_
+based on ``gcc-arm-linux-gnueabihf`` and should work on ``ARMv6`` and
+``ARMv7`` devices running Debian or Raspbian. ``armel`` builds are built
+using the ``gcc-arm-linux-gnuebi`` toolchain provided by Ubuntu and
+currently target ``ARMv7``.
+
+Windows 64 work is still stalling, we would welcome a volunteer
+to handle that.
+
+How to use PyPy?
+================
+
+We suggest using PyPy from a `virtualenv`_. Once you have a virtualenv
+installed, you can follow instructions from `pypy documentation`_ on how
+to proceed. This document also covers other `installation schemes`_.
+
+.. _`pypy documentation`:
http://doc.pypy.org/en/latest/getting-started.html#installing-using-virtualenv
+.. _`virtualenv`: http://www.virtualenv.org/en/latest/
+.. _`installation schemes`:
http://doc.pypy.org/en/latest/getting-started.html#installing-pypy
+.. _`PyPy and pip`:
http://doc.pypy.org/en/latest/getting-started.html#installing-pypy
+
+
+Cheers,
+the PyPy team
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -347,7 +347,7 @@
(self.use(typ), self.nextarg()))
def visit__ObjSpace(self, el):
- if self.finger != 0:
+ if self.finger > 1:
raise FastFuncNotSupported
self.unwrap.append("space")
@@ -414,21 +414,21 @@
mod = ""
if mod == 'pypy.interpreter.astcompiler.ast':
raise FastFuncNotSupported
- if (not mod.startswith('pypy.module.__builtin__') and
- not mod.startswith('pypy.module.sys') and
- not mod.startswith('pypy.module.math')):
- if not func.__name__.startswith('descr'):
- raise FastFuncNotSupported
+ #if (not mod.startswith('pypy.module.__builtin__') and
+ # not mod.startswith('pypy.module.sys') and
+ # not mod.startswith('pypy.module.math')):
+ # if not func.__name__.startswith('descr'):
+ # raise FastFuncNotSupported
d = {}
unwrap_info.miniglobals['func'] = func
source = """if 1:
def fastfunc_%s_%d(%s):
return func(%s)
- \n""" % (func.__name__, narg,
+ \n""" % (func.__name__.replace('-', '_'), narg,
', '.join(args),
', '.join(unwrap_info.unwrap))
exec compile2(source) in unwrap_info.miniglobals, d
- fastfunc = d['fastfunc_%s_%d' % (func.__name__, narg)]
+ fastfunc = d['fastfunc_%s_%d' % (func.__name__.replace('-', '_'),
narg)]
return narg, fastfunc
make_fastfunc = staticmethod(make_fastfunc)
diff --git a/pypy/interpreter/test/test_gateway.py
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -597,6 +597,32 @@
assert space.is_true(w_res)
assert called == [w_app_f, w_app_f]
+ def test_interp2app_fastcall_method_with_space(self):
+ class W_X(W_Root):
+ def descr_f(self, space, w_x):
+ return w_x
+
+ app_f = gateway.interp2app_temp(W_X.descr_f, unwrap_spec=['self',
+ gateway.ObjSpace, gateway.W_Root])
+
+ w_app_f = self.space.wrap(app_f)
+
+ assert isinstance(w_app_f.code, gateway.BuiltinCode2)
+
+ called = []
+ fastcall_2 = w_app_f.code.fastcall_2
+ def witness_fastcall_2(space, w_func, w_a, w_b):
+ called.append(w_func)
+ return fastcall_2(space, w_func, w_a, w_b)
+
+ w_app_f.code.fastcall_2 = witness_fastcall_2
+ space = self.space
+
+ w_res = space.call_function(w_app_f, W_X(), space.wrap(3))
+
+ assert space.is_true(w_res)
+ assert called == [w_app_f]
+
def test_plain(self):
space = 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
@@ -708,7 +708,7 @@
return MapDictIteratorValues(self.space, self, w_dict)
def iteritems(self, w_dict):
return MapDictIteratorItems(self.space, self, w_dict)
-
+
def materialize_r_dict(space, obj, dict_w):
map = obj._get_mapdict_map()
@@ -716,69 +716,69 @@
_become(obj, new_obj)
class MapDictIteratorKeys(BaseKeyIterator):
- def __init__(self, space, strategy, dictimplementation):
- BaseKeyIterator.__init__(
- self, space, strategy, dictimplementation)
- w_obj = strategy.unerase(dictimplementation.dstorage)
- self.w_obj = w_obj
- self.orig_map = self.curr_map = w_obj._get_mapdict_map()
+ def __init__(self, space, strategy, dictimplementation):
+ BaseKeyIterator.__init__(self, space, strategy, dictimplementation)
+ w_obj = strategy.unerase(dictimplementation.dstorage)
+ self.w_obj = w_obj
+ self.orig_map = self.curr_map = w_obj._get_mapdict_map()
- def next_key_entry(self):
- implementation = self.dictimplementation
- assert isinstance(implementation.strategy, MapDictStrategy)
- if self.orig_map is not self.w_obj._get_mapdict_map():
- return None
- if self.curr_map:
- curr_map = self.curr_map.search(DICT)
- if curr_map:
- self.curr_map = curr_map.back
- attr = curr_map.selector[0]
- w_attr = self.space.wrap(attr)
- return w_attr
- return None
+ def next_key_entry(self):
+ implementation = self.dictimplementation
+ assert isinstance(implementation.strategy, MapDictStrategy)
+ if self.orig_map is not self.w_obj._get_mapdict_map():
+ return None
+ if self.curr_map:
+ curr_map = self.curr_map.search(DICT)
+ if curr_map:
+ self.curr_map = curr_map.back
+ attr = curr_map.selector[0]
+ w_attr = self.space.wrap(attr)
+ return w_attr
+ return None
+
class MapDictIteratorValues(BaseValueIterator):
- def __init__(self, space, strategy, dictimplementation):
- BaseValueIterator.__init__(
- self, space, strategy, dictimplementation)
- w_obj = strategy.unerase(dictimplementation.dstorage)
- self.w_obj = w_obj
- self.orig_map = self.curr_map = w_obj._get_mapdict_map()
+ def __init__(self, space, strategy, dictimplementation):
+ BaseValueIterator.__init__(self, space, strategy, dictimplementation)
+ w_obj = strategy.unerase(dictimplementation.dstorage)
+ self.w_obj = w_obj
+ self.orig_map = self.curr_map = w_obj._get_mapdict_map()
- def next_value_entry(self):
- implementation = self.dictimplementation
- assert isinstance(implementation.strategy, MapDictStrategy)
- if self.orig_map is not self.w_obj._get_mapdict_map():
- return None
- if self.curr_map:
- curr_map = self.curr_map.search(DICT)
- if curr_map:
- self.curr_map = curr_map.back
- attr = curr_map.selector[0]
- return self.w_obj.getdictvalue(self.space, attr)
- return None
+ def next_value_entry(self):
+ implementation = self.dictimplementation
+ assert isinstance(implementation.strategy, MapDictStrategy)
+ if self.orig_map is not self.w_obj._get_mapdict_map():
+ return None
+ if self.curr_map:
+ curr_map = self.curr_map.search(DICT)
+ if curr_map:
+ self.curr_map = curr_map.back
+ attr = curr_map.selector[0]
+ return self.w_obj.getdictvalue(self.space, attr)
+ return None
+
class MapDictIteratorItems(BaseItemIterator):
- def __init__(self, space, strategy, dictimplementation):
- BaseItemIterator.__init__(
- self, space, strategy, dictimplementation)
- w_obj = strategy.unerase(dictimplementation.dstorage)
- self.w_obj = w_obj
- self.orig_map = self.curr_map = w_obj._get_mapdict_map()
+ def __init__(self, space, strategy, dictimplementation):
+ BaseItemIterator.__init__(self, space, strategy, dictimplementation)
+ w_obj = strategy.unerase(dictimplementation.dstorage)
+ self.w_obj = w_obj
+ self.orig_map = self.curr_map = w_obj._get_mapdict_map()
- def next_item_entry(self):
- implementation = self.dictimplementation
- assert isinstance(implementation.strategy, MapDictStrategy)
- if self.orig_map is not self.w_obj._get_mapdict_map():
- return None, None
- if self.curr_map:
- curr_map = self.curr_map.search(DICT)
- if curr_map:
- self.curr_map = curr_map.back
- attr = curr_map.selector[0]
- w_attr = self.space.wrap(attr)
- return w_attr, self.w_obj.getdictvalue(self.space, attr)
- return None, None
+ def next_item_entry(self):
+ implementation = self.dictimplementation
+ assert isinstance(implementation.strategy, MapDictStrategy)
+ if self.orig_map is not self.w_obj._get_mapdict_map():
+ return None, None
+ if self.curr_map:
+ curr_map = self.curr_map.search(DICT)
+ if curr_map:
+ self.curr_map = curr_map.back
+ attr = curr_map.selector[0]
+ w_attr = self.space.wrap(attr)
+ return w_attr, self.w_obj.getdictvalue(self.space, attr)
+ return None, None
+
# ____________________________________________________________
# Magic caching
@@ -860,7 +860,7 @@
#
selector = ("", INVALID)
if w_descr is None:
- selector = (name, DICT) #common case: no such attr in the class
+ selector = (name, DICT) # common case: no such attr in the
class
elif isinstance(w_descr, TypeCell):
pass # we have a TypeCell in the class: give up
elif space.is_data_descr(w_descr):
@@ -890,7 +890,6 @@
LOAD_ATTR_slowpath._dont_inline_ = True
def LOOKUP_METHOD_mapdict(f, nameindex, w_obj):
- space = f.space
pycode = f.getcode()
entry = pycode._mapdict_caches[nameindex]
if entry.is_valid_for_obj(w_obj):
diff --git a/rpython/annotator/test/test_annrpython.py
b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -740,6 +740,34 @@
s = a.build_types(f, [B])
assert s.classdef is a.bookkeeper.getuniqueclassdef(C)
+ def test_union_type_some_opbc(self):
+ class A(object):
+ name = "A"
+
+ def f(self):
+ return type(self)
+
+ class B(A):
+ name = "B"
+
+ def f(tp):
+ return tp
+
+ def main(n):
+ if n:
+ if n == 1:
+ inst = A()
+ else:
+ inst = B()
+ arg = inst.f()
+ else:
+ arg = B
+ return f(arg).name
+
+ a = self.RPythonAnnotator()
+ s = a.build_types(main, [int])
+ assert isinstance(s, annmodel.SomeString)
+
def test_ann_assert(self):
def assert_(x):
assert x,"XXX"
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit