bpo-40287: Fix SpooledTemporaryFile.seek() return value (GH-19540)
It has not returned the file position after the seek.
(cherry picked from commit 485e715cb1
)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
This commit is contained in:
parent
6b0ca0aeab
commit
9796fe88da
|
@ -735,7 +735,7 @@ class SpooledTemporaryFile:
|
|||
return self._file.readlines(*args)
|
||||
|
||||
def seek(self, *args):
|
||||
self._file.seek(*args)
|
||||
return self._file.seek(*args)
|
||||
|
||||
@property
|
||||
def softspace(self):
|
||||
|
|
|
@ -1025,7 +1025,8 @@ class TestSpooledTemporaryFile(BaseTestCase):
|
|||
# Verify writelines with a SpooledTemporaryFile
|
||||
f = self.do_create()
|
||||
f.writelines((b'x', b'y', b'z'))
|
||||
f.seek(0)
|
||||
pos = f.seek(0)
|
||||
self.assertEqual(pos, 0)
|
||||
buf = f.read()
|
||||
self.assertEqual(buf, b'xyz')
|
||||
|
||||
|
@ -1043,7 +1044,8 @@ class TestSpooledTemporaryFile(BaseTestCase):
|
|||
# when that occurs
|
||||
f = self.do_create(max_size=30)
|
||||
self.assertFalse(f._rolled)
|
||||
f.seek(100, 0)
|
||||
pos = f.seek(100, 0)
|
||||
self.assertEqual(pos, 100)
|
||||
self.assertFalse(f._rolled)
|
||||
f.write(b'x')
|
||||
self.assertTrue(f._rolled)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fixed ``SpooledTemporaryFile.seek()`` to return the position.
|
Loading…
Reference in New Issue