Author: Manuel Jacob
Branch: refactor-translator
Changeset: r66783:38845f2aeea8
Date: 2013-09-03 01:17 +0100
http://bitbucket.org/pypy/pypy/changeset/38845f2aeea8/
Log: hg merge default
diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -1,6 +1,9 @@
"""Reimplementation of the standard extension module '_curses' using cffi."""
import sys
+if sys.platform == 'win32':
+ #This module does not exist in windows
+ raise ImportError('No module named _curses')
from functools import wraps
from cffi import FFI
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -254,7 +254,7 @@
if sys.version_info < (2, 7):
raise Exception("PyPy no longer supports Python 2.6 or lower")
from pypy.interpreter.pyframe import PyFrame
- frame = PyFrame(self.space, self, w_globals, None)
+ frame = self.space.FrameClass(self.space, self, w_globals, None)
frame.setdictscope(w_locals)
return frame.run()
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1516,13 +1516,18 @@
d = BStruct.fields
assert d[0][1].offset == d[1][1].offset == d[2][1].offset == 0
assert d[3][1].offset == sizeof(BLong)
- assert d[0][1].bitshift == 0
+ def f(m, r):
+ if sys.byteorder == 'little':
+ return r
+ else:
+ return LONGBITS - m - r
+ assert d[0][1].bitshift == f(1, 0)
assert d[0][1].bitsize == 1
- assert d[1][1].bitshift == 1
+ assert d[1][1].bitshift == f(2, 1)
assert d[1][1].bitsize == 2
- assert d[2][1].bitshift == 3
+ assert d[2][1].bitshift == f(3, 3)
assert d[2][1].bitsize == 3
- assert d[3][1].bitshift == 0
+ assert d[3][1].bitshift == f(LONGBITS - 5, 0)
assert d[3][1].bitsize == LONGBITS - 5
assert sizeof(BStruct) == 2 * sizeof(BLong)
assert alignof(BStruct) == alignof(BLong)
@@ -2856,7 +2861,7 @@
('b1', BInt, 9),
('b2', BUInt, 7),
('c', BChar, -1)], -1, -1, -1, flag)
- if flag % 2 == 0: # gcc and gcc ARM
+ if flag % 2 == 0: # gcc, any variant
assert typeoffsetof(BStruct, 'c') == (BChar, 3)
assert sizeof(BStruct) == 4
else: # msvc
@@ -2864,6 +2869,31 @@
assert sizeof(BStruct) == 12
assert alignof(BStruct) == 4
#
+ p = newp(new_pointer_type(BStruct), None)
+ p.a = b'A'
+ p.b1 = -201
+ p.b2 = 99
+ p.c = b'\x9D'
+ raw = buffer(p)[:]
+ if sys.byteorder == 'little':
+ if flag == 0 or flag == 2: # gcc, little endian
+ assert raw == b'A7\xC7\x9D'
+ elif flag == 1: # msvc
+ assert raw == b'A\x00\x00\x007\xC7\x00\x00\x9D\x00\x00\x00'
+ elif flag == 4: # gcc, big endian
+ assert raw == b'A\xE3\x9B\x9D'
+ else:
+ raise AssertionError("bad flag")
+ else:
+ if flag == 0 or flag == 2: # gcc
+ assert raw == b'A\xC77\x9D'
+ elif flag == 1: # msvc
+ assert raw == b'A\x00\x00\x00\x00\x00\xC77\x9D\x00\x00\x00'
+ elif flag == 4: # gcc, big endian
+ assert raw == b'A\x9B\xE3\x9D'
+ else:
+ raise AssertionError("bad flag")
+ #
BStruct = new_struct_type("struct foo2")
complete_struct_or_union(BStruct, [('a', BChar, -1),
('', BShort, 9),
@@ -2875,16 +2905,21 @@
elif flag == 1: # msvc
assert sizeof(BStruct) == 6
assert alignof(BStruct) == 2
- else: # gcc ARM
+ elif flag == 2: # gcc ARM
assert sizeof(BStruct) == 6
assert alignof(BStruct) == 2
+ elif flag == 4: # gcc, big endian
+ assert sizeof(BStruct) == 5
+ assert alignof(BStruct) == 1
+ else:
+ raise AssertionError("bad flag")
#
BStruct = new_struct_type("struct foo2")
complete_struct_or_union(BStruct, [('a', BChar, -1),
('', BInt, 0),
('', BInt, 0),
('c', BChar, -1)], -1, -1, -1, flag)
- if flag == 0: # gcc
+ if flag == 0: # gcc
assert typeoffsetof(BStruct, 'c') == (BChar, 4)
assert sizeof(BStruct) == 5
assert alignof(BStruct) == 1
@@ -2892,10 +2927,16 @@
assert typeoffsetof(BStruct, 'c') == (BChar, 1)
assert sizeof(BStruct) == 2
assert alignof(BStruct) == 1
- else: # gcc ARM
+ elif flag == 2: # gcc ARM
assert typeoffsetof(BStruct, 'c') == (BChar, 4)
assert sizeof(BStruct) == 8
assert alignof(BStruct) == 4
+ elif flag == 4: # gcc, big endian
+ assert typeoffsetof(BStruct, 'c') == (BChar, 4)
+ assert sizeof(BStruct) == 5
+ assert alignof(BStruct) == 1
+ else:
+ raise AssertionError("bad flag")
def test_bitfield_as_gcc():
@@ -2907,6 +2948,11 @@
def test_bitfield_as_arm_gcc():
_test_bitfield_details(flag=2)
+def test_bitfield_as_big_endian():
+ if '__pypy__' in sys.builtin_module_names:
+ py.test.skip("no big endian machine supported on pypy for now")
+ _test_bitfield_details(flag=4)
+
def test_version():
# this test is here mostly for PyPy
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
@@ -992,6 +992,7 @@
assert ret == 42
def test_pyc_magic_changes(self):
+ py.test.skip("For now, PyPy generates only one kind of .pyc files")
# test that the pyc files produced by a space are not reimportable
# from another, if they differ in what opcodes they support
allspaces = [self.space]
diff --git a/pypy/module/test_lib_pypy/test_curses.py
b/pypy/module/test_lib_pypy/test_curses.py
--- a/pypy/module/test_lib_pypy/test_curses.py
+++ b/pypy/module/test_lib_pypy/test_curses.py
@@ -1,4 +1,8 @@
import pytest
+import sys
+if sys.platform == 'win32':
+ #This module does not exist in windows
+ pytest.skip('no curses on windows')
# Check that lib_pypy.cffi finds the correct version of _cffi_backend.
# Otherwise, the test is skipped. It should never be skipped when run
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit