Repository navigation
Conversation
e687c4a to
54d1f29
Compare
|
Well, it looks like pypy3k still implements the Python 2 C API and now I'm sad. I've also no idea why CPython 3.4 thinks we returned an error. |
54d1f29 to
ca77abd
Compare
The representation of Tree as a sequence causes boolean coercion to consider the empty tree to be False, which is nonsensical. Override __nonzero__ for all object types to return True. This fixes libgit2#432.
Similarly to the previous commit, an Index is not False even if it presents a sequence interface with a length of zero.
ca77abd to
851b75b
Compare
|
I am not going to start an argument on whether Python behaviour makes sense or not. But having an object which when evaluated has always the same constant value serves no purpose. If we are going to override the default behaviour, it would be to raise an error, so to say we do not support implicit logical operations with these objects. But then, what are we trying to fix? |
|
The point of this isn't so much about python's behaviour, but our usage of We still have the repository, path, whatever else of value. My point here is that an empty file isn't falsy and thus an empty index or blob shouldn't be either. But if you think that the behaviour is fine, then that's just fine; feel free to close this. |
The sequence interface, with
len(X)returning 0 makes Python consider the object falsy, which is nonsensical. Always consider these to be True.This fixes #432