mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
#10465: fix broken delegation in __getattr__ of _PaddedFile.
This commit is contained in:
parent
4ccc137aff
commit
9f1c1dcde3
3 changed files with 9 additions and 1 deletions
|
|
@ -98,7 +98,7 @@ class _PaddedFile:
|
|||
return self.file.seek(offset, whence)
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(name, self.file)
|
||||
return getattr(self.file, name)
|
||||
|
||||
|
||||
class GzipFile(io.BufferedIOBase):
|
||||
|
|
|
|||
|
|
@ -197,6 +197,12 @@ class TestGzip(unittest.TestCase):
|
|||
self.assertTrue(hasattr(f, "name"))
|
||||
self.assertEqual(f.name, self.filename)
|
||||
|
||||
def test_paddedfile_getattr(self):
|
||||
self.test_write()
|
||||
with gzip.GzipFile(self.filename, 'rb') as f:
|
||||
self.assertTrue(hasattr(f.fileobj, "name"))
|
||||
self.assertEqual(f.fileobj.name, self.filename)
|
||||
|
||||
def test_mtime(self):
|
||||
mtime = 123456789
|
||||
with gzip.GzipFile(self.filename, 'w', mtime = mtime) as fWrite:
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #10465: fix broken delegating of attributes by gzip._PaddedFile.
|
||||
|
||||
- Issue #10356: hash(Decimal("sNaN")) now raises ValueError instead of
|
||||
TypeError.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue