Author: Philip Jenvey <pjen...@underboss.org> Branch: py3.3 Changeset: r72823:1d47dd6f19e4 Date: 2014-08-15 18:02 -0700 http://bitbucket.org/pypy/pypy/changeset/1d47dd6f19e4/
Log: merge py3k diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst --- a/pypy/doc/faq.rst +++ b/pypy/doc/faq.rst @@ -147,12 +147,25 @@ programmer). Instead, since 2012, there is work going on on a still very experimental -Software Transactional Memory (STM) version of PyPy. This should give -an alternative PyPy which internally has no GIL, while at the same time +`Software Transactional Memory`_ (STM) version of PyPy. This should give +an alternative PyPy which works without a GIL, while at the same time continuing to give the Python programmer the complete illusion of having -one. It would in fact push forward *more* GIL-ish behavior, like -declaring that some sections of the code should run without releasing -the GIL in the middle (these are called *atomic sections* in STM). +one. + +.. _`Software Transactional Memory`: stm.html + +-------------------------------------------------- +Is PyPy more clever than CPython about Tail Calls? +-------------------------------------------------- + +No. PyPy follows the Python language design, including the built-in +debugger features. This prevents tail calls, as summarized by Guido +van Rossum in two__ blog__ posts. Moreover, neither the JIT nor +Stackless__ change anything to that. + +.. __: http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html +.. __: http://neopythonic.blogspot.com/2009/04/final-words-on-tail-calls.html +.. __: stackless.html ------------------------------------------ How do I write extension modules for PyPy? diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -63,6 +63,8 @@ try: while True: next_instr = self.handle_bytecode(co_code, next_instr, ec) + except Yield: + return self.popvalue() except ExitFrame: self.last_exception = None return self.popvalue() diff --git a/pypy/interpreter/test/test_generator.py b/pypy/interpreter/test/test_generator.py --- a/pypy/interpreter/test/test_generator.py +++ b/pypy/interpreter/test/test_generator.py @@ -307,12 +307,12 @@ foobar except NameError: yield 5 - raise # should raise "no active exception to re-raise" + raise gen = f() - gen.next() # --> 5 + next(gen) # --> 5 try: - gen.next() - except TypeError: + next(gen) + except NameError: pass def test_yield_return(self): diff --git a/rpython/jit/backend/llsupport/test/zrpy_gc_test.py b/rpython/jit/backend/llsupport/test/zrpy_gc_test.py --- a/rpython/jit/backend/llsupport/test/zrpy_gc_test.py +++ b/rpython/jit/backend/llsupport/test/zrpy_gc_test.py @@ -633,9 +633,9 @@ return n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s def after(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s): - check(x.x == 1800 * 2 + 1850 * 2 + 200 - 150) + check(x.x == 1800 * 2 + 150 * 2 + 200 - 1850) - return before, f, None + return before, f, after def test_compile_framework_external_exception_handling(self): self.run('compile_framework_external_exception_handling') diff --git a/rpython/rtyper/normalizecalls.py b/rpython/rtyper/normalizecalls.py --- a/rpython/rtyper/normalizecalls.py +++ b/rpython/rtyper/normalizecalls.py @@ -62,6 +62,8 @@ msg.append("the following functions:") msg.append(" %s" % ("\n ".join(pfg), )) msg.append("are called with inconsistent numbers of arguments") + msg.append("(and/or the argument names are different, which is" + " not supported in this case)") if shape1[0] != shape2[0]: msg.append("sometimes with %s arguments, sometimes with %s" % (shape1[0], shape2[0])) else: diff --git a/rpython/rtyper/test/test_normalizecalls.py b/rpython/rtyper/test/test_normalizecalls.py --- a/rpython/rtyper/test/test_normalizecalls.py +++ b/rpython/rtyper/test/test_normalizecalls.py @@ -185,6 +185,7 @@ .+Sub1.fn .+Sub2.fn are called with inconsistent numbers of arguments +\(and/or the argument names are different, which is not supported in this case\) sometimes with \d arguments, sometimes with \d the callers of these functions are: .+otherfunc _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit