File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -304,14 +304,17 @@ def do_grep(self, fp):
304304 """
305305 context = []
306306 line_count = 0
307- try :
308- status = os .fstat (fp .fileno ())
309- if stat .S_ISREG (status .st_mode ):
310- fp_size = status .st_size
311- else :
307+ if isinstance (fp , gzip .GzipFile ):
308+ fp_size = None # gzipped data is usually longer than the file
309+ else :
310+ try :
311+ status = os .fstat (fp .fileno ())
312+ if stat .S_ISREG (status .st_mode ):
313+ fp_size = status .st_size
314+ else :
315+ fp_size = None
316+ except AttributeError : # doesn't support fileno()
312317 fp_size = None
313- except AttributeError : # doesn't support fileno()
314- fp_size = None
315318
316319 block = self .read_block_with_context (None , fp , fp_size )
317320 while block .end > block .start :
You can’t perform that action at this time.
0 commit comments