]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-150484: Fix mock_open __exit__ with contextlib.ExitStack (GH-151829) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 21 Jun 2026 17:02:30 +0000 (19:02 +0200)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2026 17:02:30 +0000 (17:02 +0000)
commitbae0ba9ec71e5433c2c634644cefa093f43cc056
tree66f74be2e3c53a4cd81d19ea64adbdcb5ea4edcf
parentde8d7bb11ee9802f7431d51f2e88d1cb4b749966
[3.13] gh-150484: Fix mock_open __exit__ with contextlib.ExitStack (GH-151829) (GH-151861)

  mock_open's _exit_side_effect had a fixed 3-arg signature, but
  contextlib.ExitStack calls __exit__ with 4 args (self + 3 exc info).
  Use *args to accept any number of arguments.
(cherry picked from commit 85fa295073a0291e517ae6bd24a26e03b5925b75)

Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com>
Lib/test/test_unittest/testmock/testmock.py
Lib/unittest/mock.py
Misc/NEWS.d/next/Library/2026-05-28-00-00-00.gh-issue-150484.XxYyZz.rst [new file with mode: 0644]