]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-150484: Fix mock_open __exit__ with contextlib.ExitStack (GH-151829)
authorZang Peiyu <166481866+factnn@users.noreply.github.com>
Sun, 21 Jun 2026 16:39:36 +0000 (00:39 +0800)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2026 16:39:36 +0000 (19:39 +0300)
commit85fa295073a0291e517ae6bd24a26e03b5925b75
tree301da7add957123b3828fb344d9cbe64632beb9c
parent20270886c67a06cd0d04b4cec8125b727617e7bb
[3.14] gh-150484: Fix mock_open __exit__ with contextlib.ExitStack (GH-151829)

  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.
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]