[pypy-commit] pypy default: merged upstream
alex_gaynor
noreply at buildbot.pypy.org
Fri Mar 23 17:29:14 CET 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r53946:6b7f1e0d0f31
Date: 2012-03-23 12:28 -0400
http://bitbucket.org/pypy/pypy/changeset/6b7f1e0d0f31/
Log: merged upstream
diff --git a/pypy/doc/sandbox.rst b/pypy/doc/sandbox.rst
--- a/pypy/doc/sandbox.rst
+++ b/pypy/doc/sandbox.rst
@@ -82,7 +82,10 @@
In pypy/translator/goal::
- ./translate.py --sandbox targetpypystandalone.py
+ ./translate.py -O2 --sandbox targetpypystandalone.py
+
+If you don't have a regular PyPy installed, you should, because it's
+faster to translate, but you can also run ``python translate.py`` instead.
To run it, use the tools in the pypy/translator/sandbox directory::
diff --git a/pypy/doc/you-want-to-help.rst b/pypy/doc/you-want-to-help.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/you-want-to-help.rst
@@ -0,0 +1,70 @@
+
+You want to help with PyPy, now what?
+=====================================
+
+PyPy is a very large project that has a reputation of being hard to dive into.
+Some of this fame is warranted, some of it is purely accidental. There are three
+important lessons that everyone willing to contribute should learn:
+
+* PyPy has layers. There are many pieces of architecture that are very well
+ separated from each other. More about this below, but often the manifestation
+ of this is that things are at a different layer than you would expect them
+ to be. For example if you are looking for the JIT implementation, you will
+ not find it in the implementation of the Python programming language.
+
+* Because of the above, we are very serious about Test Driven Development.
+ It's not only what we believe in, but also that PyPy's architecture is
+ working very well with TDD in mind and not so well without it. Often
+ the development means progressing in an unrelated corner, one unittest
+ at a time; and then flipping a giant switch, bringing it all together.
+ (It generally works out of the box. If it doesn't, then we didn't
+ write enough unit tests.) It's worth repeating - PyPy
+ approach is great if you do TDD, not so great otherwise.
+
+* PyPy uses an entirely different set of tools - most of them included
+ in the PyPy repository. There is no Makefile, nor autoconf. More below
+
+Architecture
+============
+
+PyPy has layers. The 100 miles view:
+
+* `RPython`_ is the language in which we write interpreters. Not the entire
+ PyPy project is written in RPython, only the parts that are compiled in
+ the translation process. The interesting point is that RPython has no parser,
+ it's compiled from the live python objects, which make it possible to do
+ all kinds of metaprogramming during import time. In short, Python is a meta
+ programming language for RPython.
+
+ The RPython standard library is to be found in the ``rlib`` subdirectory.
+
+.. _`RPython`: coding-guide.html#RPython
+
+* The translation toolchain - this is the part that takes care about translating
+ RPython to flow graphs and then to C. There is more in the `architecture`_
+ document written about it.
+
+ It mostly lives in ``rpython``, ``annotator`` and ``objspace/flow``.
+
+.. _`architecture`: architecture.html
+
+* Python Interpreter
+
+ xxx
+
+* Python modules
+
+ xxx
+
+* JIT
+
+ xxx
+
+* Garbage Collectors
+
+ xxx
+
+Toolset
+=======
+
+xxx
diff --git a/pypy/interpreter/test/test_objspace.py b/pypy/interpreter/test/test_objspace.py
--- a/pypy/interpreter/test/test_objspace.py
+++ b/pypy/interpreter/test/test_objspace.py
@@ -312,8 +312,8 @@
mods = space.get_builtinmodule_to_install()
assert '__pypy__' in mods # real builtin
- assert 'array' not in mods # in lib_pypy
- assert 'faked+array' not in mods # in lib_pypy
+ assert '_functools' not in mods # in lib_pypy
+ assert 'faked+_functools' not in mods # in lib_pypy
assert 'this_doesnt_exist' not in mods # not in lib_pypy
assert 'faked+this_doesnt_exist' in mods # not in lib_pypy, but in
# ALL_BUILTIN_MODULES
diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py
--- a/pypy/interpreter/test/test_zzpickle_and_slow.py
+++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
@@ -75,6 +75,7 @@
class AppTestInterpObjectPickling:
pytestmark = py.test.mark.skipif("config.option.runappdirect")
def setup_class(cls):
+ cls.space = gettestobjspace(usemodules=['struct'])
_attach_helpers(cls.space)
def teardown_class(cls):
diff --git a/pypy/jit/backend/x86/rx86.py b/pypy/jit/backend/x86/rx86.py
--- a/pypy/jit/backend/x86/rx86.py
+++ b/pypy/jit/backend/x86/rx86.py
@@ -601,7 +601,9 @@
CVTSS2SD_xb = xmminsn('\xF3', rex_nw, '\x0F\x5A',
register(1, 8), stack_bp(2))
- # These work on machine sized registers.
+ # These work on machine sized registers, so MOVD is actually MOVQ
+ # when running on 64 bits. Note a bug in the Intel documentation:
+ # http://lists.gnu.org/archive/html/bug-binutils/2007-07/msg00095.html
MOVD_rx = xmminsn('\x66', rex_w, '\x0F\x7E', register(2, 8), register(1), '\xC0')
MOVD_xr = xmminsn('\x66', rex_w, '\x0F\x6E', register(1, 8), register(2), '\xC0')
MOVD_xb = xmminsn('\x66', rex_w, '\x0F\x6E', register(1, 8), stack_bp(2))
diff --git a/pypy/jit/backend/x86/test/test_rx86_32_auto_encoding.py b/pypy/jit/backend/x86/test/test_rx86_32_auto_encoding.py
--- a/pypy/jit/backend/x86/test/test_rx86_32_auto_encoding.py
+++ b/pypy/jit/backend/x86/test/test_rx86_32_auto_encoding.py
@@ -182,6 +182,12 @@
filename = str(testdir.join(FILENAME % methname))
g = open(inputname, 'w')
g.write('\x09.string "%s"\n' % BEGIN_TAG)
+ #
+ if instrname == 'MOVD' and self.WORD == 8:
+ instrname = 'MOVQ'
+ if argmodes == 'xb':
+ py.test.skip('"as" uses an undocumented alternate encoding??')
+ #
for args in args_lists:
suffix = ""
## all = instr.as_all_suffixes
@@ -229,9 +235,6 @@
# movq $xxx, %rax => movl $xxx, %eax
suffix = 'l'
ops[1] = reduce_to_32bit(ops[1])
- if instrname.lower() == 'movd':
- ops[0] = reduce_to_32bit(ops[0])
- ops[1] = reduce_to_32bit(ops[1])
#
op = '\t%s%s %s%s' % (instrname.lower(), suffix,
', '.join(ops), following)
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
@@ -1,9 +1,10 @@
import py
-
+from pypy.conftest import gettestobjspace
class AppTestAST:
def setup_class(cls):
+ cls.space = gettestobjspace(usemodules=['struct'])
cls.w_ast = cls.space.appexec([], """():
import _ast
return _ast""")
diff --git a/pypy/module/_codecs/test/test_codecs.py b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -4,7 +4,7 @@
class AppTestCodecs:
def setup_class(cls):
- space = gettestobjspace(usemodules=('unicodedata',))
+ space = gettestobjspace(usemodules=('unicodedata', 'struct'))
cls.space = space
def test_register_noncallable(self):
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
@@ -106,8 +106,9 @@
version = 0
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=('_continuation',),
+ 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/_multiprocessing/test/test_connection.py b/pypy/module/_multiprocessing/test/test_connection.py
--- a/pypy/module/_multiprocessing/test/test_connection.py
+++ b/pypy/module/_multiprocessing/test/test_connection.py
@@ -92,7 +92,8 @@
class AppTestSocketConnection(BaseConnectionTest):
def setup_class(cls):
- space = gettestobjspace(usemodules=('_multiprocessing', 'thread', 'signal'))
+ space = gettestobjspace(usemodules=('_multiprocessing', 'thread', 'signal',
+ 'struct', 'array'))
cls.space = space
cls.w_connections = space.newlist([])
diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -6,7 +6,7 @@
from pypy.rpython.lltypesystem import lltype, rffi
def setup_module(mod):
- mod.space = gettestobjspace(usemodules=['_socket', 'array'])
+ mod.space = gettestobjspace(usemodules=['_socket', 'array', 'struct'])
global socket
import socket
mod.w_socket = space.appexec([], "(): import _socket as m; return m")
diff --git a/pypy/module/_ssl/test/test_ssl.py b/pypy/module/_ssl/test/test_ssl.py
--- a/pypy/module/_ssl/test/test_ssl.py
+++ b/pypy/module/_ssl/test/test_ssl.py
@@ -90,7 +90,7 @@
class AppTestConnectedSSL:
def setup_class(cls):
- space = gettestobjspace(usemodules=('_ssl', '_socket'))
+ space = gettestobjspace(usemodules=('_ssl', '_socket', 'struct'))
cls.space = space
def setup_method(self, method):
@@ -179,7 +179,7 @@
# to exercise the poll() calls
def setup_class(cls):
- space = gettestobjspace(usemodules=('_ssl', '_socket'))
+ space = gettestobjspace(usemodules=('_ssl', '_socket', 'struct'))
cls.space = space
cls.space.appexec([], """():
import socket; socket.setdefaulttimeout(1)
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
@@ -10,7 +10,7 @@
return False
def pytest_funcarg__space(request):
- return gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'])
+ return gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array'])
def pytest_funcarg__api(request):
return request.cls.api
diff --git a/pypy/module/cpyext/test/test_api.py b/pypy/module/cpyext/test/test_api.py
--- a/pypy/module/cpyext/test/test_api.py
+++ b/pypy/module/cpyext/test/test_api.py
@@ -19,7 +19,8 @@
class BaseApiTest(LeakCheckingTest):
def setup_class(cls):
- cls.space = space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'])
+ cls.space = space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi',
+ 'array'])
# warm up reference counts:
# - the posix module allocates a HCRYPTPROV on Windows
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
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
@@ -35,7 +35,7 @@
class AppTestApi:
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'])
+ cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array'])
from pypy.rlib.libffi import get_libc_name
cls.w_libc = cls.space.wrap(get_libc_name())
@@ -165,8 +165,9 @@
return leaking
class AppTestCpythonExtensionBase(LeakCheckingTest):
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi'])
+ cls.space = gettestobjspace(usemodules=['cpyext', 'thread', '_rawffi', 'array'])
cls.space.getbuiltinmodule("cpyext")
from pypy.module.imp.importing import importhook
importhook(cls.space, "os") # warm up reference counts
diff --git a/pypy/module/cpyext/test/test_import.py b/pypy/module/cpyext/test/test_import.py
--- a/pypy/module/cpyext/test/test_import.py
+++ b/pypy/module/cpyext/test/test_import.py
@@ -19,7 +19,7 @@
space.wrap('__name__'))) == 'foobar'
def test_getmoduledict(self, space, api):
- testmod = "binascii"
+ testmod = "_functools"
w_pre_dict = api.PyImport_GetModuleDict()
assert not space.is_true(space.contains(w_pre_dict, space.wrap(testmod)))
diff --git a/pypy/module/fcntl/test/test_fcntl.py b/pypy/module/fcntl/test/test_fcntl.py
--- a/pypy/module/fcntl/test/test_fcntl.py
+++ b/pypy/module/fcntl/test/test_fcntl.py
@@ -13,7 +13,7 @@
class AppTestFcntl:
def setup_class(cls):
- space = gettestobjspace(usemodules=('fcntl', 'array'))
+ space = gettestobjspace(usemodules=('fcntl', 'array', 'struct'))
cls.space = space
tmpprefix = str(udir.ensure('test_fcntl', dir=1).join('tmp_'))
cls.w_tmp = space.wrap(tmpprefix)
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/itertools/test/test_itertools.py b/pypy/module/itertools/test/test_itertools.py
--- a/pypy/module/itertools/test/test_itertools.py
+++ b/pypy/module/itertools/test/test_itertools.py
@@ -891,7 +891,7 @@
class AppTestItertools27:
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['itertools'])
+ cls.space = gettestobjspace(usemodules=['itertools', 'struct'])
if cls.space.is_true(cls.space.appexec([], """():
import sys; return sys.version_info < (2, 7)
""")):
diff --git a/pypy/module/math/test/test_math.py b/pypy/module/math/test/test_math.py
--- a/pypy/module/math/test/test_math.py
+++ b/pypy/module/math/test/test_math.py
@@ -6,7 +6,7 @@
class AppTestMath:
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['math'])
+ cls.space = gettestobjspace(usemodules=['math', 'struct'])
cls.w_cases = cls.space.wrap(test_direct.MathTests.TESTCASES)
cls.w_consistent_host = cls.space.wrap(test_direct.consistent_host)
diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -359,6 +359,7 @@
name="int64",
char="q",
w_box_type=space.gettypefor(interp_boxes.W_Int64Box),
+ alternate_constructors=[space.w_long],
)
self.w_uint64dtype = W_Dtype(
types.UInt64(),
@@ -386,23 +387,6 @@
alternate_constructors=[space.w_float],
aliases=["float"],
)
- self.w_longlongdtype = W_Dtype(
- types.Int64(),
- num=9,
- kind=SIGNEDLTR,
- name='int64',
- char='q',
- w_box_type = space.gettypefor(interp_boxes.W_LongLongBox),
- alternate_constructors=[space.w_long],
- )
- self.w_ulonglongdtype = W_Dtype(
- types.UInt64(),
- num=10,
- kind=UNSIGNEDLTR,
- name='uint64',
- char='Q',
- w_box_type = space.gettypefor(interp_boxes.W_ULongLongBox),
- )
self.w_stringdtype = W_Dtype(
types.StringType(1),
num=18,
@@ -435,17 +419,19 @@
self.w_booldtype, self.w_int8dtype, self.w_uint8dtype,
self.w_int16dtype, self.w_uint16dtype, self.w_int32dtype,
self.w_uint32dtype, self.w_longdtype, self.w_ulongdtype,
- self.w_longlongdtype, self.w_ulonglongdtype,
+ self.w_int64dtype, self.w_uint64dtype,
self.w_float32dtype,
self.w_float64dtype, self.w_stringdtype, self.w_unicodedtype,
self.w_voiddtype,
]
- self.dtypes_by_num_bytes = sorted(
+ self.float_dtypes_by_num_bytes = sorted(
(dtype.itemtype.get_element_size(), dtype)
- for dtype in self.builtin_dtypes
+ for dtype in [self.w_float32dtype, self.w_float64dtype]
)
self.dtypes_by_name = {}
- for dtype in self.builtin_dtypes:
+ # we reverse, so the stuff with lower numbers override stuff with
+ # higher numbers
+ for dtype in reversed(self.builtin_dtypes):
self.dtypes_by_name[dtype.name] = dtype
can_name = dtype.kind + str(dtype.itemtype.get_element_size())
self.dtypes_by_name[can_name] = dtype
@@ -473,7 +459,7 @@
'LONG': self.w_longdtype,
'UNICODE': self.w_unicodedtype,
#'OBJECT',
- 'ULONGLONG': self.w_ulonglongdtype,
+ 'ULONGLONG': self.w_uint64dtype,
'STRING': self.w_stringdtype,
#'CDOUBLE',
#'DATETIME',
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/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -314,7 +314,7 @@
return dt
if dt.num >= 5:
return interp_dtype.get_dtype_cache(space).w_float64dtype
- for bytes, dtype in interp_dtype.get_dtype_cache(space).dtypes_by_num_bytes:
+ for bytes, dtype in interp_dtype.get_dtype_cache(space).float_dtypes_by_num_bytes:
if (dtype.kind == interp_dtype.FLOATINGLTR and
dtype.itemtype.get_element_size() > dt.itemtype.get_element_size()):
return dtype
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -302,6 +302,7 @@
else:
raises(OverflowError, numpy.int32, 2147483648)
raises(OverflowError, numpy.int32, '2147483648')
+ assert numpy.dtype('int32') is numpy.dtype(numpy.int32)
def test_uint32(self):
import sys
@@ -333,15 +334,11 @@
assert numpy.dtype(numpy.int64).type is numpy.int64
assert numpy.int64(3) == 3
- if sys.maxint >= 2 ** 63 - 1:
- assert numpy.int64(9223372036854775807) == 9223372036854775807
- assert numpy.int64('9223372036854775807') == 9223372036854775807
- else:
- raises(OverflowError, numpy.int64, 9223372036854775807)
- raises(OverflowError, numpy.int64, '9223372036854775807')
+ assert numpy.int64(9223372036854775807) == 9223372036854775807
+ assert numpy.int64(9223372036854775807) == 9223372036854775807
raises(OverflowError, numpy.int64, 9223372036854775808)
- raises(OverflowError, numpy.int64, '9223372036854775808')
+ raises(OverflowError, numpy.int64, 9223372036854775808L)
def test_uint64(self):
import sys
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/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -197,7 +197,6 @@
def test_signbit(self):
from _numpypy import signbit, copysign
- import struct
assert (signbit([0, 0.0, 1, 1.0, float('inf'), float('nan')]) ==
[False, False, False, False, False, False]).all()
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -500,6 +500,19 @@
BoxType = interp_boxes.W_ULongBox
format_code = "L"
+def _int64_coerce(self, space, w_item):
+ try:
+ return self._base_coerce(space, w_item)
+ except OperationError, e:
+ if not e.match(space, space.w_OverflowError):
+ raise
+ bigint = space.bigint_w(w_item)
+ try:
+ value = bigint.tolonglong()
+ except OverflowError:
+ raise OperationError(space.w_OverflowError, space.w_None)
+ return self.box(value)
+
class Int64(BaseType, Integer):
_attrs_ = ()
@@ -507,6 +520,8 @@
BoxType = interp_boxes.W_Int64Box
format_code = "q"
+ _coerce = func_with_new_name(_int64_coerce, '_coerce')
+
class NonNativeInt64(BaseType, NonNativeInteger):
_attrs_ = ()
@@ -514,6 +529,8 @@
BoxType = interp_boxes.W_Int64Box
format_code = "q"
+ _coerce = func_with_new_name(_int64_coerce, '_coerce')
+
def _uint64_coerce(self, space, w_item):
try:
return self._base_coerce(space, w_item)
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -14,10 +14,10 @@
def setup_module(mod):
if os.name != 'nt':
- mod.space = gettestobjspace(usemodules=['posix', 'fcntl'])
+ mod.space = gettestobjspace(usemodules=['posix', 'fcntl', 'struct'])
else:
# On windows, os.popen uses the subprocess module
- mod.space = gettestobjspace(usemodules=['posix', '_rawffi', 'thread'])
+ mod.space = gettestobjspace(usemodules=['posix', '_rawffi', 'thread', 'struct'])
mod.path = udir.join('posixtestfile.txt')
mod.path.write("this is a test")
mod.path2 = udir.join('test_posix2-')
diff --git a/pypy/module/rctime/test/test_rctime.py b/pypy/module/rctime/test/test_rctime.py
--- a/pypy/module/rctime/test/test_rctime.py
+++ b/pypy/module/rctime/test/test_rctime.py
@@ -3,7 +3,7 @@
class AppTestRCTime:
def setup_class(cls):
- space = gettestobjspace(usemodules=('rctime',))
+ space = gettestobjspace(usemodules=('rctime', 'struct'))
cls.space = space
def test_attributes(self):
diff --git a/pypy/module/test_lib_pypy/test_binascii.py b/pypy/module/test_lib_pypy/test_binascii.py
deleted file mode 100644
--- a/pypy/module/test_lib_pypy/test_binascii.py
+++ /dev/null
@@ -1,8 +0,0 @@
-
-""" Some more binascii.py tests
-"""
-
-class AppTestBinAscii:
- def test_incorrect_padding(self):
- import binascii
- raises(binascii.Error, "'x'.decode('base64')")
diff --git a/pypy/module/zipimport/test/test_undocumented.py b/pypy/module/zipimport/test/test_undocumented.py
--- a/pypy/module/zipimport/test/test_undocumented.py
+++ b/pypy/module/zipimport/test/test_undocumented.py
@@ -19,7 +19,7 @@
class AppTestZipImport:
def setup_class(cls):
- space = gettestobjspace(usemodules=['zipimport', 'rctime'])
+ space = gettestobjspace(usemodules=['zipimport', 'rctime', 'struct'])
cls.space = space
cls.w_created_paths = space.wrap(created_paths)
diff --git a/pypy/module/zipimport/test/test_zipimport.py b/pypy/module/zipimport/test/test_zipimport.py
--- a/pypy/module/zipimport/test/test_zipimport.py
+++ b/pypy/module/zipimport/test/test_zipimport.py
@@ -47,9 +47,9 @@
""").compile()
if cls.compression == ZIP_DEFLATED:
- space = gettestobjspace(usemodules=['zipimport', 'zlib', 'rctime'])
+ space = gettestobjspace(usemodules=['zipimport', 'zlib', 'rctime', 'struct'])
else:
- space = gettestobjspace(usemodules=['zipimport', 'rctime'])
+ space = gettestobjspace(usemodules=['zipimport', 'rctime', 'struct'])
cls.space = space
tmpdir = udir.ensure('zipimport_%s' % cls.__name__, dir=1)
diff --git a/pypy/objspace/flow/model.py b/pypy/objspace/flow/model.py
--- a/pypy/objspace/flow/model.py
+++ b/pypy/objspace/flow/model.py
@@ -7,8 +7,7 @@
from pypy.tool.uid import uid, Hashable
from pypy.tool.descriptor import roproperty
from pypy.tool.sourcetools import PY_IDENTIFIER, nice_repr_for_func
-from pypy.tool.identity_dict import identity_dict
-from pypy.rlib.rarithmetic import is_valid_int, r_longlong, r_ulonglong
+from pypy.rlib.rarithmetic import is_valid_int, r_longlong, r_ulonglong, r_uint
"""
@@ -546,7 +545,7 @@
for n in cases[:len(cases)-has_default]:
if is_valid_int(n):
continue
- if isinstance(n, (r_longlong, r_ulonglong)):
+ if isinstance(n, (r_longlong, r_ulonglong, r_uint)):
continue
if isinstance(n, (str, unicode)) and len(n) == 1:
continue
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/rlib/rzipfile.py b/pypy/rlib/rzipfile.py
--- a/pypy/rlib/rzipfile.py
+++ b/pypy/rlib/rzipfile.py
@@ -12,8 +12,7 @@
rzlib = None
# XXX hack to get crc32 to work
-from pypy.tool.lib_pypy import import_from_lib_pypy
-crc_32_tab = import_from_lib_pypy('binascii').crc_32_tab
+from pypy.module.binascii.interp_crc32 import crc_32_tab
rcrc_32_tab = [r_uint(i) for i in crc_32_tab]
diff --git a/pypy/tool/test/test_lib_pypy.py b/pypy/tool/test/test_lib_pypy.py
--- a/pypy/tool/test/test_lib_pypy.py
+++ b/pypy/tool/test/test_lib_pypy.py
@@ -11,7 +11,7 @@
assert lib_pypy.LIB_PYTHON_MODIFIED.check(dir=1)
def test_import_from_lib_pypy():
- binascii = lib_pypy.import_from_lib_pypy('binascii')
- assert type(binascii) is type(lib_pypy)
- assert binascii.__name__ == 'lib_pypy.binascii'
- assert hasattr(binascii, 'crc_32_tab')
+ _functools = lib_pypy.import_from_lib_pypy('_functools')
+ assert type(_functools) is type(lib_pypy)
+ assert _functools.__name__ == 'lib_pypy._functools'
+ assert hasattr(_functools, 'partial')
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