Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r92447:167b802baf3b Date: 2017-09-23 14:43 +0200 http://bitbucket.org/pypy/pypy/changeset/167b802baf3b/
Log: Issue #2628 Take the 'fake_frame' objects returned by sys._current_frames() on PyPy, and make inspect.isframe() return True on them. This lets a few more inspect functions work with them. diff --git a/lib-python/2.7/inspect.py b/lib-python/2.7/inspect.py --- a/lib-python/2.7/inspect.py +++ b/lib-python/2.7/inspect.py @@ -203,7 +203,7 @@ f_locals local namespace seen by this frame f_restricted 0 or 1 if frame is in restricted execution mode f_trace tracing function for this frame, or None""" - return isinstance(object, types.FrameType) + return isinstance(object, (types.FrameType, types.FakeFrameType)) def iscode(object): """Return true if the object is a code object. diff --git a/lib-python/2.7/types.py b/lib-python/2.7/types.py --- a/lib-python/2.7/types.py +++ b/lib-python/2.7/types.py @@ -71,6 +71,12 @@ FrameType = type(tb.tb_frame) del tb +# PyPy extension +try: + FakeFrameType = type(next(sys._current_frames().itervalues())) +except AttributeError: + FakeFrameType = FrameType + SliceType = slice EllipsisType = type(Ellipsis) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit