[pypy-commit] pypy missing-ndarray-attributes: merge default into branch
mattip
noreply at buildbot.pypy.org
Tue Jan 22 22:58:53 CET 2013
Author: mattip <matti.picus at gmail.com>
Branch: missing-ndarray-attributes
Changeset: r60353:e22c2ae3da06
Date: 2013-01-22 23:58 +0200
http://bitbucket.org/pypy/pypy/changeset/e22c2ae3da06/
Log: merge default into branch
diff --git a/pypy/doc/arm.rst b/pypy/doc/arm.rst
--- a/pypy/doc/arm.rst
+++ b/pypy/doc/arm.rst
@@ -130,15 +130,7 @@
export SB2=/srv/chroot/precise_arm
export SB2OPT='-t ARM'
-Once this is set, you can call the translator
-
-::
-
- pypy ~/path_to_pypy_checkout/pypy/translator/goal/translate.py -O1 --platform=arm target.py
-
-If everything worked correctly this should yield an ARM binary. Running this binary in the ARM chroot or on an ARM device should produce the output ``"Hello World"``.
-
-.. _`this`:
+Once this is set, you can call the translator. For example save this file
::
@@ -148,3 +140,22 @@
def target(*args):
return main, None
+
+and call the translator
+
+::
+
+ pypy ~/path_to_pypy_checkout/pypy/translator/goal/translate.py -O1 --platform=arm target.py
+
+If everything worked correctly this should yield an ARM binary. Running this binary in the ARM chroot or on an ARM device should produce the output ``"Hello World"``.
+
+To translate the full python pypy interpreter with a jit, you can cd into pypy/goal and call
+
+::
+
+ pypy <path to rpython>/rpython/translator/goal/translate.py -Ojit --platform=arm --gcrootfinder=shadowstack --jit-backend=arm targetpypystandalone.py
+
+The gcrootfinder option is needed to work around `issue 1377`_ and the jit-backend works around `issue 1376`_
+
+.. _`issue 1377`: https://bugs.pypy.org/issue1377
+.. _`issue 1376`: https://bugs.pypy.org/issue1376
diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -904,8 +904,9 @@
def visit_Set(self, s):
self.update_position(s.lineno)
+ elt_count = len(s.elts) if s.elts is not None else 0
self.visit_sequence(s.elts)
- self.emit_op_arg(ops.BUILD_SET, len(s.elts))
+ self.emit_op_arg(ops.BUILD_SET, elt_count)
def visit_Name(self, name):
self.update_position(name.lineno)
diff --git a/pypy/module/_ast/test/test_ast.py b/pypy/module/_ast/test/test_ast.py
--- a/pypy/module/_ast/test/test_ast.py
+++ b/pypy/module/_ast/test/test_ast.py
@@ -290,6 +290,12 @@
])
exec compile(body, '<string>', 'exec')
+ def test_empty_set(self):
+ import ast
+ m = ast.Module(body=[ast.Expr(value=ast.Set(elts=[]))])
+ ast.fix_missing_locations(m)
+ compile(m, "<test>", "exec")
+
def test_invalid_sum(self):
import _ast as ast
pos = dict(lineno=2, col_offset=3)
diff --git a/pypy/module/cpyext/classobject.py b/pypy/module/cpyext/classobject.py
--- a/pypy/module/cpyext/classobject.py
+++ b/pypy/module/cpyext/classobject.py
@@ -22,6 +22,12 @@
w_result.setdict(space, w_dict)
return w_result
+ at cpython_api([PyObject, PyObject, PyObject], PyObject)
+def PyInstance_New(space, w_cls, w_arg, w_kw):
+ """Create a new instance of a specific class. The parameters arg and kw are
+ used as the positional and keyword parameters to the object's constructor."""
+ return space.call(w_cls, w_arg, w_kw)
+
@cpython_api([PyObject, PyObject], PyObject, error=CANNOT_FAIL)
def _PyInstance_Lookup(space, w_instance, w_name):
name = space.str_w(w_name)
diff --git a/pypy/module/cpyext/include/ceval.h b/pypy/module/cpyext/include/ceval.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/include/ceval.h
@@ -0,0 +1,1 @@
+/* empty */
diff --git a/pypy/module/cpyext/stubs.py b/pypy/module/cpyext/stubs.py
--- a/pypy/module/cpyext/stubs.py
+++ b/pypy/module/cpyext/stubs.py
@@ -176,12 +176,6 @@
"""Return true if klass is a subclass of base. Return false in all other cases."""
raise NotImplementedError
- at cpython_api([PyObject, PyObject, PyObject], PyObject)
-def PyInstance_New(space, cls, arg, kw):
- """Create a new instance of a specific class. The parameters arg and kw are
- used as the positional and keyword parameters to the object's constructor."""
- raise NotImplementedError
-
@cpython_api([PyObject], rffi.INT_real, error=-1)
def PyCodec_Register(space, search_function):
"""Register a new codec search function.
diff --git a/pypy/module/cpyext/test/conftest.py b/pypy/module/cpyext/test/conftest.py
--- a/pypy/module/cpyext/test/conftest.py
+++ b/pypy/module/cpyext/test/conftest.py
@@ -1,6 +1,15 @@
import py
import pytest
+def pytest_configure(config):
+ from pypy.tool.pytest.objspace import gettestobjspace
+ # For some reason (probably a ll2ctypes cache issue on linux64)
+ # it's necessary to run "import time" at least once before any
+ # other cpyext test, otherwise the same statement will fail in
+ # test_datetime.py.
+ space = gettestobjspace(usemodules=['rctime'])
+ space.getbuiltinmodule("time")
+
def pytest_ignore_collect(path, config):
if config.option.runappdirect:
return True # "cannot be run by py.test -A"
diff --git a/pypy/module/cpyext/test/test_classobject.py b/pypy/module/cpyext/test/test_classobject.py
--- a/pypy/module/cpyext/test/test_classobject.py
+++ b/pypy/module/cpyext/test/test_classobject.py
@@ -7,8 +7,10 @@
w_class = space.appexec([], """():
class C:
x = None
- def __init__(self):
+ def __init__(self, *args, **kwargs):
self.x = 1
+ self.args = args
+ self.__dict__.update(kwargs)
return C
""")
@@ -22,6 +24,13 @@
assert space.getattr(w_instance, space.wrap('x')) is space.w_None
assert space.unwrap(space.getattr(w_instance, space.wrap('a'))) == 3
+ w_instance = api.PyInstance_New(w_class,
+ space.wrap((3,)), space.wrap(dict(y=2)))
+ assert space.unwrap(space.getattr(w_instance, space.wrap('x'))) == 1
+ assert space.unwrap(space.getattr(w_instance, space.wrap('y'))) == 2
+ assert space.unwrap(space.getattr(w_instance, space.wrap('args'))) == (3,)
+
+
def test_lookup(self, space, api):
w_instance = space.appexec([], """():
class C:
diff --git a/pypy/pytest-A.cfg b/pypy/pytest-A.cfg
--- a/pypy/pytest-A.cfg
+++ b/pypy/pytest-A.cfg
@@ -1,5 +1,5 @@
cherrypick = ['interpreter', 'objspace/test', 'objspace/std', 'module']
-interp = ['translator/goal/pypy-c']
+interp = ['goal/pypy-c']
test_driver = ['test_all.py', '-A']
diff --git a/pypy/test_all.py b/pypy/test_all.py
--- a/pypy/test_all.py
+++ b/pypy/test_all.py
@@ -23,7 +23,8 @@
if len(sys.argv) == 1 and os.path.dirname(sys.argv[0]) in '.':
print >> sys.stderr, __doc__
sys.exit(2)
-
+ #Add toplevel repository dir to sys.path
+ sys.path.insert(0,os.path.dirname(os.path.dirname(__file__)))
import pytest
import pytest_cov
sys.exit(pytest.main(plugins=[pytest_cov]))
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -11,8 +11,10 @@
import shutil
import sys
+import os
+#Add toplevel repository dir to sys.path
+sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
import py
-import os
import fnmatch
from rpython.tool.udir import udir
diff --git a/pypy/bin/translatorshell.py b/rpython/bin/translatorshell.py
rename from pypy/bin/translatorshell.py
rename to rpython/bin/translatorshell.py
diff --git a/rpython/jit/backend/arm/test/support.py b/rpython/jit/backend/arm/test/support.py
--- a/rpython/jit/backend/arm/test/support.py
+++ b/rpython/jit/backend/arm/test/support.py
@@ -14,6 +14,9 @@
def check_jumps(self, maxcount):
pass
+if not getattr(os, 'uname', None):
+ pytest.skip('cannot run arm tests on non-posix platform')
+
if os.uname()[1] == 'llaima.local':
AS = '~/Code/arm-jit/android/android-ndk-r4b//build/prebuilt/darwin-x86/arm-eabi-4.4.0/arm-eabi/bin/as'
else:
More information about the pypy-commit
mailing list