]> granicus.if.org Git - python/commit
[3.6] bpo-25532: Protect against infinite loops in inspect.unwrap() (GH-1717) (#3778)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 27 Sep 2017 06:34:44 +0000 (09:34 +0300)
committerGitHub <noreply@github.com>
Wed, 27 Sep 2017 06:34:44 +0000 (09:34 +0300)
commit02c3cdcef84edd8c71e9fe189873dea216acfc1d
treee633c37492d35a475f8e224369948d602d633e3d
parent680429b133660d170269565413f4c9e36e68def6
[3.6] bpo-25532: Protect against infinite loops in inspect.unwrap() (GH-1717) (#3778)

Some objects (like test mocks) auto-generate new objects on
attribute access, which can lead to an infinite loop in
inspect.unwrap().

Ensuring references are retained to otherwise temporary objects
and capping the size of the memo dict turns this case into a
conventional exception instead..
(cherry picked from commit f9169ce6b48c7cc7cc62d9eb5e4ee1ac7066d14b)
Lib/inspect.py
Lib/test/test_inspect.py
Misc/NEWS.d/next/Library/2017-09-27-08-11-38.bpo-25532.ey4Yez.rst [new file with mode: 0644]