Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r71355:f7d70d54b9d9 Date: 2014-05-06 16:58 -0700 http://bitbucket.org/pypy/pypy/changeset/f7d70d54b9d9/
Log: merge default diff --git a/lib_pypy/_pypy_interact.py b/lib_pypy/_pypy_interact.py --- a/lib_pypy/_pypy_interact.py +++ b/lib_pypy/_pypy_interact.py @@ -3,6 +3,8 @@ import sys import os +irc_header = "And now for something completely different" + def interactive_console(mainmodule=None, quiet=False): # set sys.{ps1,ps2} just before invoking the interactive interpreter. This @@ -15,8 +17,7 @@ if not quiet: try: from _pypy_irc_topic import some_topic - text = "And now for something completely different: ``%s''" % ( - some_topic(),) + text = "%s: ``%s''" % ( irc_header, some_topic()) while len(text) >= 80: i = text[:80].rfind(' ') print(text[:i]) diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst --- a/pypy/doc/cpython_differences.rst +++ b/pypy/doc/cpython_differences.rst @@ -348,4 +348,9 @@ type and vice versa. For builtin types, a dictionary will be returned that cannot be changed (but still looks and behaves like a normal dictionary). +* PyPy prints a random line from past #pypy IRC topics at startup in + interactive mode. In a released version, this behaviour is supressed, but + setting the environment variable PYPY_IRC_TOPIC will bring it back. Note that + downstream package providers have been known to totally disable this feature. + .. include:: _ref.txt diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst --- a/pypy/doc/how-to-release.rst +++ b/pypy/doc/how-to-release.rst @@ -28,7 +28,10 @@ pypy/doc/tool/makecontributor.py generates the list of contributors * rename pypy/doc/whatsnew_head.rst to whatsnew_VERSION.rst and create a fresh whatsnew_head.rst after the release -* update README +* merge PYPY_IRC_TOPIC environment variable handling from previous release + in pypy/doc/getting-started-dev.rst, pypy/doc/man/pypy.1.rst, and + pypy/interpreter/app_main.py so release versions will not print a random + IRC topic by default. * change the tracker to have a new release tag to file bugs against * go to pypy/tool/release and run: force-builds.py <release branch> diff --git a/pypy/doc/release-2.3.0.rst b/pypy/doc/release-2.3.0.rst --- a/pypy/doc/release-2.3.0.rst +++ b/pypy/doc/release-2.3.0.rst @@ -1,5 +1,5 @@ ======================================= -PyPy 2.3 - Easier Than Ever +PyPy 2.3 - Terrestrial Arthropod Trap ======================================= We're pleased to announce PyPy 2.3, which targets version 2.7.6 of the Python diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -7,6 +7,11 @@ from rpython.tool.udir import udir from contextlib import contextmanager from pypy.conftest import pypydir +from pypy.module.sys.version import PYPY_VERSION +from lib_pypy._pypy_interact import irc_header + +is_release = PYPY_VERSION[3] == "final" + python3 = os.environ.get("PYTHON3", "python3") @@ -250,6 +255,10 @@ child = self.spawn([]) child.expect('Python ') # banner child.expect('>>> ') # prompt + if is_release: + assert irc_header not in child.before + else: + assert irc_header in child.before child.sendline('[6*7]') child.expect(re.escape('[42]')) child.sendline('def f(x):') diff --git a/pypy/module/operator/test/test_operator.py b/pypy/module/operator/test/test_operator.py --- a/pypy/module/operator/test/test_operator.py +++ b/pypy/module/operator/test/test_operator.py @@ -179,6 +179,8 @@ assert operator.index(42) == 42 assert operator.__index__(42) == 42 raises(TypeError, operator.index, "abc") + exc = raises(TypeError, operator.index, "abc") + assert str(exc.value) == "'str' object cannot be interpreted as an index" def test_indexOf(self): import operator diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py --- a/pypy/module/pypyjit/test_pypy_c/test_struct.py +++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py @@ -1,6 +1,18 @@ +import sys from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC +if sys.maxsize == 2 ** 63 - 1: + extra = """ + i8 = int_ge(i4, -2147483648) + guard_true(i8, descr=...) + i9 = int_le(i4, 2147483647) + guard_true(i9, descr=...) + """ +else: + extra = "" + + class TestStruct(BaseTestPyPyC): def test_struct_function(self): def main(n): @@ -20,10 +32,7 @@ assert loop.match_by_id("struct", """ guard_not_invalidated(descr=...) # struct.pack - i8 = int_ge(i4, -2147483648) - guard_true(i8, descr=...) - i9 = int_le(i4, 2147483647) - guard_true(i9, descr=...) + %s i11 = int_and(i4, 255) i13 = int_rshift(i4, 8) i14 = int_and(i13, 255) @@ -41,7 +50,7 @@ guard_false(i28, descr=...) i30 = int_lshift(i20, 24) i31 = int_or(i26, i30) - """) + """ % extra) def test_struct_object(self): def main(n): @@ -60,10 +69,7 @@ assert loop.match_by_id('struct', """ guard_not_invalidated(descr=...) # struct.pack - i8 = int_ge(i4, -2147483648) - guard_true(i8, descr=...) - i9 = int_le(i4, 2147483647) - guard_true(i9, descr=...) + %s i11 = int_and(i4, 255) i13 = int_rshift(i4, 8) i14 = int_and(i13, 255) @@ -81,4 +87,4 @@ guard_false(i28, descr=...) i30 = int_lshift(i20, 24) i31 = int_or(i26, i30) - """) + """ % extra) diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py --- a/pypy/objspace/descroperation.py +++ b/pypy/objspace/descroperation.py @@ -632,13 +632,18 @@ l = ["space.isinstance_w(w_result, %s)" % x for x in checkerspec] checker = " or ".join(l) + if targetname == 'index': + msg = "'%%T' object cannot be interpreted as an index" + else: + msg = "unsupported operand type for %(targetname)s(): '%%T'" + msg = msg % locals() source = """if 1: def %(targetname)s(space, w_obj): w_impl = space.lookup(w_obj, %(specialname)r) if w_impl is None: raise oefmt(space.w_TypeError, - "unsupported operand type for %(targetname)s(): " - "'%%T'", w_obj) + %(msg)r, + w_obj) w_result = space.get_and_call_function(w_impl, w_obj) if %(checker)s: diff --git a/rpython/tool/version.py b/rpython/tool/version.py --- a/rpython/tool/version.py +++ b/rpython/tool/version.py @@ -2,7 +2,7 @@ import os from subprocess import Popen, PIPE import rpython -rpythondir = os.path.dirname(os.path.abspath(rpython.__file__)) +rpythondir = os.path.dirname(os.path.realpath(rpython.__file__)) rpythonroot = os.path.dirname(rpythondir) default_retval = '?', '?' diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py --- a/rpython/translator/c/genc.py +++ b/rpython/translator/c/genc.py @@ -537,6 +537,8 @@ pypkgpath = localpath.pypkgpath() if pypkgpath: relpypath = localpath.relto(pypkgpath.dirname) + assert relpypath, ("%r should be relative to %r" % + (localpath, pypkgpath.dirname)) return relpypath.replace('.py', '.c') return None if hasattr(node.obj, 'graph'): diff --git a/rpython/translator/goal/richards.py b/rpython/translator/goal/richards.py --- a/rpython/translator/goal/richards.py +++ b/rpython/translator/goal/richards.py @@ -102,13 +102,13 @@ self.task_waiting = False self.task_holding = False return self - + def waitingWithPacket(self): self.packet_pending = True self.task_waiting = True self.task_holding = False return self - + def isPacketPending(self): return self.packet_pending @@ -154,6 +154,7 @@ self.holdCount = 0 self.qpktCount = 0 +taskWorkArea = TaskWorkArea() class Task(TaskState): @@ -235,7 +236,7 @@ if t is None: raise Exception("Bad task id %d" % id) return t - + # DeviceTask @@ -309,7 +310,7 @@ else: i.control = i.control/2 ^ 0xd008 return self.release(I_DEVB) - + # WorkTask @@ -384,7 +385,7 @@ wkq = None; DeviceTask(I_DEVA, 4000, wkq, TaskState().waiting(), DeviceTaskRec()); DeviceTask(I_DEVB, 5000, wkq, TaskState().waiting(), DeviceTaskRec()); - + schedule() if taskWorkArea.holdCount == 9297 and taskWorkArea.qpktCount == 23246: diff --git a/rpython/translator/platform/__init__.py b/rpython/translator/platform/__init__.py --- a/rpython/translator/platform/__init__.py +++ b/rpython/translator/platform/__init__.py @@ -170,6 +170,9 @@ ofile = cfile.new(ext=ext) if ofile.relto(udir): return ofile + assert ofile.relto(rpythonroot), ( + "%r should be relative to either %r or %r" % ( + ofile, rpythonroot, udir)) ofile = udir.join(ofile.relto(rpythonroot)) ofile.dirpath().ensure(dir=True) return ofile diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py --- a/rpython/translator/platform/posix.py +++ b/rpython/translator/platform/posix.py @@ -253,6 +253,9 @@ if fpath.dirpath() == self.makefile_dir: return fpath.basename elif fpath.dirpath().dirpath() == self.makefile_dir.dirpath(): + assert fpath.relto(self.makefile_dir.dirpath()), ( + "%r should be relative to %r" % ( + fpath, self.makefile_dir.dirpath())) path = '../' + fpath.relto(self.makefile_dir.dirpath()) return path.replace('\\', '/') else: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit