Content-Length: 286071 | pFad | https://github.com/python/cpython/issues/111835

ad Add `seekable` method for `mmap.mmap` · Issue #111835 · python/cpython · GitHub
Skip to content

Add seekable method for mmap.mmap #111835

Description

@technillogue

Bug report

Bug description:

mmap.mmap has a seek() method, but no seekable() method. Because of this, it cannot be used an argument for ZipFile, which requires a file-like object with seekable. A small patch is enough to fix this

class SeekableMmap(mmap.mmap):
    def seekable(self):
        return True

Now SeekableMmap can be passed to ZipFile without issue. It's easy to fix, but I can't think of any reasons why mmap shouldn't have a seekable method.

CPython versions tested on:

3.8, 3.11

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/111835

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy