@@ -624,7 +624,7 @@ def _get(section_dict, key, default=None):
624624__version_date__ = str(__version_date_info__[0]) + "." + str(
625625 __version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
626626__revision__ = __version_info__[3]
627- __revision_id__ = "$Id: d13b86e09c7003fa60c729b4895fa15cdaaee0d2 $"
627+ __revision_id__ = "$Id: 99c30dfa3a1a500ddbf705ad57f55427004ca435 $"
628628if(__version_info__[4] is not None):
629629 __version_date_plusrc__ = __version_date__ + \
630630 "-" + str(__version_date_info__[4])
@@ -8885,8 +8885,24 @@ def UncompressFileAlt(fp, formatspecs=__file_format_multi_dict__, filestart=0,
88858885
88868886 return FileLikeAdapter(fp, mode="rb", mm=mm)
88878887
8888- def UncompressFile(infile, formatspecs=__file_format_multi_dict__, mode="rb",
8889- filestart=0, use_mmap=False):
8888+ def UncompressFileAlt(fp, formatspecs=__file_format_multi_dict__, filestart=0,
8889+ use_mmap=False):
8890+ """
8891+ Accepts an already-open *bytes* file-like (fp). Detects compression and
8892+ returns a FileLikeAdapter opened for 'rb'. If the stream is uncompressed
8893+ and backed by a real file, you can enable mmap via use_mmap=True.
8894+ """
8895+ if not hasattr(fp, "read"):
8896+ return False
8897+
8898+ # If caller already gave us a FileLikeAdapter => honor it and return it.
8899+ if isinstance(fp, FileLikeAdapter):
8900+ try:
8901+ fp.write_through = True
8902+ except Exception:
8903+ pass
8904+ return fp
8905+
88908906 """
88918907 Opens a path, detects compression by header, and returns a FileLikeAdapter.
88928908 If uncompressed and use_mmap=True, returns an mmap-backed reader.
0 commit comments