gh-69528: Distinguish between file modes "wb+" and "rb+" (GH-137834)

Co-authored-by: Xiang Zhang <angwerzx@126.com>
This commit is contained in:
Stan Ulbrych 2025-10-21 18:33:30 +01:00 committed by GitHub
parent 60df1d7e0c
commit 02c1abfc54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 27 additions and 10 deletions

View file

@ -639,7 +639,7 @@ def test_fileobj_mode(self):
with open(self.filename, mode) as f:
with gzip.GzipFile(fileobj=f) as g:
self.assertEqual(g.mode, gzip.READ)
for mode in "wb", "ab", "xb":
for mode in "wb", "ab", "xb", "wb+", "ab+", "xb+":
if "x" in mode:
os_helper.unlink(self.filename)
with open(self.filename, mode) as f: