Issue #11 resolved

Comparing Path() equal to whatever raises an AttributeError

July Tikhonov
created an issue

As it can be seen from the behavior of built-in Python types, equality of objects evaluates to either True or False, and even completely unrelated objects do not raise any errors on equality comparison - their comparison just returns False.

But the pathlib.*Path() objects will raise AttributeError if their counterpart does not have _cparts and _flavour attributes.

>>> dict() == list
False
>>> Path() == list
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/site-packages/pathlib.py", line 799, in __eq__
    return self._cparts == other._cparts and self._flavour is other._flavour
AttributeError: type object 'list' has no attribute '_cparts'

Patch uploaded.

Comments (1)

  1. Log in to comment