Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1695

GridOut does not implement seekable() from io.IOBase

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.8
    • Affects Version/s: 3.7.2
    • Component/s: GridFS
    • Labels:
      None
    • Fully Compatible

      PR: https://github.com/mongodb/mongo-python-driver/pull/387

       

      Description from GitHub PR:

      I'm testing out moving our system to using Python3.7. We have an instance where we are using [ZipFile](https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile) on a `GridOut` instance. Because [seekable()](https://www.python.org/dev/peps/pep-3116/#raw-i-o) is defined as part of the IO API the ZipFile implementation does not handle an `AttributeError` coming from accessing the `seekable` method.

      This appears to be a change in the `ZipFile` implementation between Python3.6 and Python3.7.

      The `GridOut` implementation is relatively close to implementing `io.IOBase` so I figured I would close the gap, have it subclass `io.IOBase` and also note where it diverges from the `io.IOBase` behavior.

      I don't use `ZipFile` against a `GridIn` instance and it diverges from `io.IOBase` in that it doesn't return the number of bytes written so I refrained from making it a subclass of `io.IOBase`

       

       

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            terencehonles Terence Honles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: