]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35753: Fix crash in doctest with unwrap-able functions (GH-22981) (#25926)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 May 2021 18:01:21 +0000 (11:01 -0700)
committerGitHub <noreply@github.com>
Wed, 5 May 2021 18:01:21 +0000 (20:01 +0200)
commit10d6f6bfd749c0e7da51a96f53ca326c336f7a00
treeae5dc9e22210b4a6c2d65c2e2556fa9e6ed900be
parentce4fee210bb604726e5da0ff15952a60c2098f88
bpo-35753: Fix crash in doctest with unwrap-able functions (GH-22981) (#25926)

Ignore objects that inspect.unwrap throws due to
too many wrappers.  This is a very rare case, however
it can easily be surfaced when a module under doctest
imports unitest.mock.call into its namespace.

We simply skip any object that throws this exception.
This should handle the majority of cases.
(cherry picked from commit 565a31804c1139fe7886f38af3b3923653b0c1b3)

Co-authored-by: Alfred Perlstein <alfred@fb.com>
Lib/doctest.py
Lib/test/test_doctest.py
Misc/NEWS.d/next/Tests/2020-10-25-19-20-26.bpo-35753.2LT-hO.rst [new file with mode: 0644]