Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r89655:4d7690bc23c2 Date: 2017-01-18 12:47 +0100 http://bitbucket.org/pypy/pypy/changeset/4d7690bc23c2/
Log: hg merge default diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py --- a/pypy/interpreter/executioncontext.py +++ b/pypy/interpreter/executioncontext.py @@ -325,7 +325,9 @@ try: w_result = space.call_function(w_callback, space.wrap(frame), space.wrap(event), w_arg) if space.is_w(w_result, space.w_None): - d.w_f_trace = None + # bug-to-bug compatibility with CPython + # http://bugs.python.org/issue11992 + pass #d.w_f_trace = None else: d.w_f_trace = w_result except: diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py --- a/pypy/interpreter/test/test_pyframe.py +++ b/pypy/interpreter/test/test_pyframe.py @@ -67,8 +67,12 @@ def test_f_lineno_set(self): def tracer(f, *args): + def y(f, *args): + return y def x(f, *args): f.f_lineno += 1 + return y # "return None" should have the same effect, but see + # test_local_trace_function_returning_None_ignored return x # obscure: call open beforehand, py3k's open invokes some app @@ -773,6 +777,29 @@ assert frames[-4].f_code.co_name == 'f' """ + def test_local_trace_function_returning_None_ignored(self): + # behave the same as CPython does, and in contradiction with + # the documentation. + def tracer(f, event, arg): + assert event == 'call' + return local_tracer + + seen = [] + def local_tracer(f, event, arg): + seen.append(event) + return None # but 'local_tracer' will be called again + + def function(): + a = 1 + a = 2 + a = 3 + + import sys + sys.settrace(tracer) + function() + sys.settrace(None) + assert seen == ["line", "line", "line", "return"] + def test_clear_locals(self): def make_frames(): def outer(): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit