summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-27 21:02:02 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-27 21:02:02 (GMT)
commit5cfb05eef04707679077a45ebbe2b096840261a0 (patch)
tree57bcd4e40f31a8b3a36bffee8931e6244006bec1 /Lib/gzip.py
parentfe393f47c662c307d2d3e90f785edf5821d54a8d (diff)
downloadcpython-5cfb05eef04707679077a45ebbe2b096840261a0.zip
cpython-5cfb05eef04707679077a45ebbe2b096840261a0.tar.gz
cpython-5cfb05eef04707679077a45ebbe2b096840261a0.tar.bz2
Added a new fileno() method. ZODB's repozo.py wants this so it can
apply os.fsync() to the GzipFile backup files it creates.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index d51b7db..9cab995 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -5,7 +5,7 @@ but random access is not allowed."""
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
-import struct, sys, time
+import os, struct, sys, time
import zlib
import __builtin__
@@ -334,6 +334,14 @@ class GzipFile:
def flush(self):
self.fileobj.flush()
+ def fileno(self):
+ """Invoke the underlying file object's fileno() method.
+
+ This will raise AttributeError if the underlying file object
+ doesn't support fileno().
+ """
+ return self.fileobj.fileno()
+
def isatty(self):
return False