- 
    Type:Bug 
- 
    Resolution: Done
- 
    Priority:Major - P3 
- 
    Affects Version/s: None
- 
    Component/s: None
- 
    None
- 
    Environment:Not environment dependent
- 
        None
- 
        Minor Change
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
I hit an issue recently when using pymongo inside Abstract Base Class. For example the test.py file raise an exception when executed:
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    a = A()
TypeError: Can't instantiate abstract class A with abstract methods col
It's because ABCMeta try to get attribute __isabstractmethod__ on Collection (https://github.com/python-git/python/blob/master/Lib/abc.py#L80) and Collection return a sub-collection in __getattr__ (https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/collection.py#L130).
A simple fix could be to not return a sub-collection if name begins with "__".
I can write a workaround for this issue but adding "col.__isabstractmethod__ = False" is not very clean.
I hope the issue is clear enough.
- is duplicated by
- 
                    PYTHON-645 Add some checks for Collection.__getattr__ -         
- Closed
 
-         
- related to
- 
                    MOTOR-104 Can't use Motor object as property of class that inherits from ABC -         
- Closed
 
-