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

Make GridOut implement full io.IOBase spec

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.0
    • Affects Version/s: None
    • Component/s: GridFS
    • None
    • Minor Change

      The GridOut object returned from e.g. the gridfs `get` method says it returns a "file-like" object. However, it does not fully conform to any interface of the python standard library io streams class hierarchy (see https://docs.python.org/3/library/io.html#class-hierarchy ).

      This makes GridOut objects (unnecessarily) fail with e.g. pyarrow, as it expects other methods to be present. See here: https://gist.github.com/henrifroese/715b14b9891405cf47a013f69ecd7147  for a minimal example and quick explanation why it specifically fails.

       

      The GridOut object already has all functionality in place to make it inherit from IOBase (or at least implement the full interface) without any breaking changes (only adds new functionality), and the IOBase spec (https://docs.python.org/3/library/io.html#i-o-base-classes ) specifies expected behaviour of the "missing" methods, so it should be relatively straightforward to implement.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            hf2000510@gmail.com Henri Froese
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: