python / cpython

The Python programming language
https://www.python.org
Other
63.19k stars 30.26k forks source link

gzip module only supports half of possible read/write scenarios #83527

Open d877e7cd-0a43-4c06-ae55-7f08ac375d6b opened 4 years ago

d877e7cd-0a43-4c06-ae55-7f08ac375d6b commented 4 years ago
BPO 39346

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['3.8', 'type-feature', 'library'] title = 'gzip module only supports half of possible read/write scenarios' updated_at = user = 'https://bugs.python.org/ddevault' ``` bugs.python.org fields: ```python activity = actor = 'ddevault' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'ddevault' dependencies = [] files = [] hgrepos = [] issue_num = 39346 keywords = [] message_count = 1.0 messages = ['360072'] nosy_count = 1.0 nosy_names = ['ddevault'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue39346' versions = ['Python 3.8'] ```

d877e7cd-0a43-4c06-ae55-7f08ac375d6b commented 4 years ago

A gzip file can have uncompressed data written to it, writing compressed data to the underlying file. It can also have uncompressed data read from it, reading compressed data from the underlying file.

However, it does not support reading compressed data from an underlying uncompressed file, nor writing compressed data to an underlying uncompressed file.

This makes it impossible to, for example, obtain an arbitrary file-like object and produce another file-like object which transparently compresses data read from the first.