File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -272,13 +272,15 @@ def _infer_compression(filepath_or_buffer, compression):
272
272
if compression is None :
273
273
return None
274
274
275
- # Cannot infer compression of a buffer. Hence assume no compression.
276
- is_path = isinstance (filepath_or_buffer , compat .string_types )
277
- if compression == 'infer' and not is_path :
278
- return None
279
-
280
- # Infer compression from the filename/URL extension
275
+ # Infer compression
281
276
if compression == 'infer' :
277
+ # Convert all path types (e.g. pathlib.Path) to strings
278
+ filepath_or_buffer = _stringify_path (filepath_or_buffer )
279
+ if not isinstance (filepath_or_buffer , compat .string_types ):
280
+ # Cannot infer compression of a buffer, assume no compression
281
+ return None
282
+
283
+ # Infer compression from the filename/URL extension
282
284
for compression , extension in _compression_to_extension .items ():
283
285
if filepath_or_buffer .endswith (extension ):
284
286
return compression
You can’t perform that action at this time.
0 commit comments