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

Make GridOut implement full io.IOBase spec

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Unknown
    • Resolution: Fixed
    • None
    • 4.0
    • GridFS
    • None
    • Minor Change

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: