[pypy-commit] pypy default: merge heads
arigo
noreply at buildbot.pypy.org
Fri Mar 23 07:47:28 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r53935:3f6079ca9f34
Date: 2012-03-23 07:46 +0100
http://bitbucket.org/pypy/pypy/changeset/3f6079ca9f34/
Log: merge heads
diff --git a/pypy/module/_continuation/test/test_zpickle.py b/pypy/module/_continuation/test/test_zpickle.py
--- a/pypy/module/_continuation/test/test_zpickle.py
+++ b/pypy/module/_continuation/test/test_zpickle.py
@@ -108,6 +108,7 @@
def setup_class(cls):
cls.space = gettestobjspace(usemodules=('_continuation', 'struct'),
CALL_METHOD=True)
+ cls.space.config.translation.continuation = True
cls.space.appexec([], """():
global continulet, A, __name__
diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py
--- a/pypy/module/cpyext/test/test_arraymodule.py
+++ b/pypy/module/cpyext/test/test_arraymodule.py
@@ -1,3 +1,4 @@
+from pypy.conftest import gettestobjspace
from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
import py
@@ -5,6 +6,7 @@
class AppTestArrayModule(AppTestCpythonExtensionBase):
enable_leak_checking = False
+ extra_modules = ['array']
def test_basic(self):
module = self.import_module(name='array')
diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -165,8 +165,11 @@
return leaking
class AppTestCpythonExtensionBase(LeakCheckingTest):
+ extra_modules = []
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array'])
+ cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'] +
+ cls.extra_modules)
cls.space.getbuiltinmodule("cpyext")
from pypy.module.imp.importing import importhook
importhook(cls.space, "os") # warm up reference counts
diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -987,6 +987,10 @@
os.environ['LANG'] = oldlang
class AppTestImportHooks(object):
+
+ def setup_class(cls):
+ cls.space = gettestobjspace(usemodules=('struct',))
+
def test_meta_path(self):
tried_imports = []
class Importer(object):
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -1125,7 +1125,8 @@
@unwrap_spec(subok=bool, copy=bool, ownmaskna=bool)
def array(space, w_item_or_iterable, w_dtype=None, w_order=None,
- subok=True, copy=True, w_maskna=None, ownmaskna=False):
+ subok=True, copy=True, w_maskna=None, ownmaskna=False,
+ w_ndmin=None):
# find scalar
if w_maskna is None:
w_maskna = space.w_None
@@ -1170,8 +1171,13 @@
break
if dtype is None:
dtype = interp_dtype.get_dtype_cache(space).w_float64dtype
+ shapelen = len(shape)
+ if w_ndmin is not None and not space.is_w(w_ndmin, space.w_None):
+ ndmin = space.int_w(w_ndmin)
+ if ndmin > shapelen:
+ shape = [1] * (ndmin - shapelen) + shape
+ shapelen = ndmin
arr = W_NDimArray(shape[:], dtype=dtype, order=order)
- shapelen = len(shape)
arr_iter = arr.create_iter()
# XXX we might want to have a jitdriver here
for i in range(len(elems_w)):
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -211,6 +211,18 @@
assert a.shape == (3,)
assert a.dtype is dtype(int)
+ def test_ndmin(self):
+ from _numpypy import array
+
+ arr = array([[[1]]], ndmin=1)
+ assert arr.shape == (1, 1, 1)
+
+ def test_noop_ndmin(self):
+ from _numpypy import array
+
+ arr = array([1], ndmin=3)
+ assert arr.shape == (1, 1, 1)
+
def test_type(self):
from _numpypy import array
ar = array(range(5))
diff --git a/pypy/objspace/std/ropeobject.py b/pypy/objspace/std/ropeobject.py
--- a/pypy/objspace/std/ropeobject.py
+++ b/pypy/objspace/std/ropeobject.py
@@ -41,11 +41,6 @@
return w_self
return W_RopeObject(w_self._node)
- def unicode_w(w_self, space):
- # XXX should this use the default encoding?
- from pypy.objspace.std.unicodetype import plain_str2unicode
- return plain_str2unicode(space, w_self._node.flatten_string())
-
W_RopeObject.EMPTY = W_RopeObject(rope.LiteralStringNode.EMPTY)
W_RopeObject.PREBUILT = [W_RopeObject(rope.LiteralStringNode.PREBUILT[i])
for i in range(256)]
diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -37,6 +37,20 @@
return None
return space.wrap(compute_unique_id(space.str_w(self)))
+ def unicode_w(w_self, space):
+ # Use the default encoding.
+ from pypy.objspace.std.unicodetype import unicode_from_string, \
+ decode_object
+ w_defaultencoding = space.call_function(space.sys.get(
+ 'getdefaultencoding'))
+ from pypy.objspace.std.unicodetype import _get_encoding_and_errors, \
+ unicode_from_string, decode_object
+ encoding, errors = _get_encoding_and_errors(space, w_defaultencoding,
+ space.w_None)
+ if encoding is None and errors is None:
+ return space.unicode_w(unicode_from_string(space, w_self))
+ return space.unicode_w(decode_object(space, w_self, encoding, errors))
+
class W_StringObject(W_AbstractStringObject):
from pypy.objspace.std.stringtype import str_typedef as typedef
@@ -55,20 +69,6 @@
def str_w(w_self, space):
return w_self._value
- def unicode_w(w_self, space):
- # Use the default encoding.
- from pypy.objspace.std.unicodetype import unicode_from_string, \
- decode_object
- w_defaultencoding = space.call_function(space.sys.get(
- 'getdefaultencoding'))
- from pypy.objspace.std.unicodetype import _get_encoding_and_errors, \
- unicode_from_string, decode_object
- encoding, errors = _get_encoding_and_errors(space, w_defaultencoding,
- space.w_None)
- if encoding is None and errors is None:
- return space.unicode_w(unicode_from_string(space, w_self))
- return space.unicode_w(decode_object(space, w_self, encoding, errors))
-
registerimplementation(W_StringObject)
W_StringObject.EMPTY = W_StringObject('')
diff --git a/pypy/translator/c/gcc/trackgcroot.py b/pypy/translator/c/gcc/trackgcroot.py
--- a/pypy/translator/c/gcc/trackgcroot.py
+++ b/pypy/translator/c/gcc/trackgcroot.py
@@ -484,7 +484,7 @@
'shl', 'shr', 'sal', 'sar', 'rol', 'ror', 'mul', 'imul', 'div', 'idiv',
'bswap', 'bt', 'rdtsc',
'punpck', 'pshufd', 'pcmp', 'pand', 'psllw', 'pslld', 'psllq',
- 'paddq', 'pinsr', 'pmul', 'psrl',
+ 'paddq', 'pinsr', 'pmul', 'psrl', 'vmul',
# sign-extending moves should not produce GC pointers
'cbtw', 'cwtl', 'cwtd', 'cltd', 'cltq', 'cqto',
# zero-extending moves should not produce GC pointers
diff --git a/pypy/translator/test/test_driver.py b/pypy/translator/test/test_driver.py
--- a/pypy/translator/test/test_driver.py
+++ b/pypy/translator/test/test_driver.py
@@ -6,7 +6,7 @@
def test_ctr():
td = TranslationDriver()
expected = ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source',
- 'compile', 'run', 'pyjitpl']
+ 'compile', 'pyjitpl']
assert set(td.exposed) == set(expected)
assert td.backend_select_goals(['compile_c']) == ['compile_c']
@@ -33,7 +33,6 @@
'rtype_ootype', 'rtype_lltype',
'source_cli', 'source_c',
'compile_cli', 'compile_c',
- 'run_c', 'run_cli',
'compile_jvm', 'source_jvm', 'run_jvm',
'pyjitpl_lltype',
'pyjitpl_ootype']
@@ -50,6 +49,6 @@
'backendopt_lltype']
expected = ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source_c',
- 'compile_c', 'run_c', 'pyjitpl']
+ 'compile_c', 'pyjitpl']
assert set(td.exposed) == set(expected)
More information about the pypy-commit
mailing list