Author: Christian Tismer <tis...@stackless.com> Branch: win64-stage1 Changeset: r53664:4a490357f4d4 Date: 2012-03-14 20:41 -0700 http://bitbucket.org/pypy/pypy/changeset/4a490357f4d4/
Log: some cleanups and removals diff --git a/pypy/jit/backend/x86/codebuf.py b/pypy/jit/backend/x86/codebuf.py --- a/pypy/jit/backend/x86/codebuf.py +++ b/pypy/jit/backend/x86/codebuf.py @@ -48,7 +48,7 @@ if self.relocations is not None: for reloc in self.relocations: p = addr + reloc - adr = rffi.cast(rffi.SIGNEDP, p - WORD) + adr = rffi.cast(rffi.LONGP, p - WORD) adr[0] = intmask(adr[0] - p) valgrind.discard_translations(addr, self.get_relative_pos()) self._dump(addr, "jit-backend-dump", backend_name) diff --git a/pypy/jit/tl/tlc.py b/pypy/jit/tl/tlc.py --- a/pypy/jit/tl/tlc.py +++ b/pypy/jit/tl/tlc.py @@ -241,7 +241,7 @@ return interp_eval(code, pc, args, pool).int_o() def interp_eval(code, pc, args, pool): - assert isinstance(pc, (int, long)) + assert is_valid_int(pc) frame = Frame(args, pc) pc = frame.pc diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_as_parameter.py b/pypy/module/test_lib_pypy/ctypes_tests/test_as_parameter.py --- a/pypy/module/test_lib_pypy/ctypes_tests/test_as_parameter.py +++ b/pypy/module/test_lib_pypy/ctypes_tests/test_as_parameter.py @@ -1,8 +1,6 @@ from ctypes import * import py from support import BaseCTypesTestChecker -from pypy.rlib.rarithmetic import is_valid_int - def setup_module(mod): import conftest @@ -138,7 +136,7 @@ f.argtypes = [c_longlong, MyCallback] def callback(value): - assert is_valid_int(value) + assert isinstance(value, (int, long)) return value & 0x7FFFFFFF cb = MyCallback(callback) diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py b/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py --- a/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py +++ b/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py @@ -9,8 +9,6 @@ import sys import py from support import BaseCTypesTestChecker -from pypy.rlib.rarithmetic import is_valid_int - try: WINFUNCTYPE @@ -329,7 +327,7 @@ f.argtypes = [c_longlong, MyCallback] def callback(value): - assert is_valid_int(value) + assert isinstance(value, (int, long)) return value & 0x7FFFFFFF cb = MyCallback(callback) diff --git a/pypy/objspace/std/test/test_longobject.py b/pypy/objspace/std/test/test_longobject.py --- a/pypy/objspace/std/test/test_longobject.py +++ b/pypy/objspace/std/test/test_longobject.py @@ -225,7 +225,6 @@ assert x ^ 0x555555555L == 0x5FFFFFFFFL def test_hash(self): - import sys # ints have the same hash as equal longs for i in range(-4, 14): assert hash(i) == hash(long(i)) @@ -234,8 +233,6 @@ assert hash(1234567890123456789L) in ( -1895067127, # with 32-bit platforms 1234567890123456789) # with 64-bit platforms - assert hash(long(sys.maxint)) == sys.maxint - assert hash(long(-sys.maxint-1)) == -sys.maxint-1 def test_math_log(self): import math diff --git a/pypy/objspace/std/test/test_obj.py b/pypy/objspace/std/test/test_obj.py --- a/pypy/objspace/std/test/test_obj.py +++ b/pypy/objspace/std/test/test_obj.py @@ -147,6 +147,28 @@ s = "a" assert self.unwrap_wrap_str(s) is s + def test_is_on_subclasses(self): + for typ in [int, long, float, complex, str, unicode]: + class mytyp(typ): + pass + if not self.cpython_apptest and typ not in (str, unicode): + assert typ(42) is typ(42) + assert mytyp(42) is not mytyp(42) + assert mytyp(42) is not typ(42) + assert typ(42) is not mytyp(42) + x = mytyp(42) + assert x is x + assert x is not "43" + assert x is not None + assert "43" is not x + assert None is not x + x = typ(42) + assert x is x + assert x is not "43" + assert x is not None + assert "43" is not x + assert None is not x + def test_id_on_primitives(self): if self.cpython_apptest: skip("cpython behaves differently") @@ -226,12 +248,18 @@ if a is b: assert a == b + def test_identity_bug(self): + x = 0x4000000000000000L + y = 2j + assert id(x) != id(y) + def test_object_hash_immutable(self): x = 42 y = 40 y += 2 assert object.__hash__(x) == object.__hash__(y) + def test_isinstance_shortcut(): from pypy.objspace.std import objspace space = objspace.StdObjSpace() _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit