Patch gridfs without using isinstance. by pcorpet · Pull Request #761 · mongomock/mongomock

@pcorpet

@pcorpet

@codecov

thequilo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the internals of pymongo too well, so I can't tell if all details are right. My use-case with Python 3.10 works with this PR!


def __init__(self, collection, *args, **kwargs):
self.__root_collection = collection
super(_MongoMockGridOutCursor, self).__init__(collection.files, *args, **kwargs)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: Why do you pass arguments to super? The docs and the linked guide don't recommend this, but it doesn't hurt either (except for readability in my opinion)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only historical python2-compatible code. I won't change it in this PR as I'm just moving those lines from below.