compiler error
brown opened this issue · 3 comments
When I compile src/diff.c I get an error for the following code in Diff_getitem:
if (PyLong_Check(value) < 0)
return NULL;
Apparently PyLong_Check returns a boolean, which can never be negative,
so the test will never succeed.
There are not boolean values in C, PyLong_Check
returns an int
, check
https://docs.python.org/2/c-api/long.html#c.PyLong_Check
Please post the error.
Here is the compiler error message. PyLong_Check returns
0 or 1 so the comparison is always false.
third_party/py/pygit2/src/diff.c:485:29: error: comparison of constant 0
with boolean expression is always false
[-Werror,-Wtautological-constant-out-of-range-compare]
if (PyLong_Check(value) < 0)
^ ~
1 error generated.
On Fri, Feb 20, 2015 at 3:52 AM, J. David Ibáñez notifications@github.com
wrote:
There are not boolean values in C, PyLong_Check returns an int, check
https://docs.python.org/2/c-api/long.html#c.PyLong_CheckPlease post the error.
—
Reply to this email directly or view it on GitHub
#495 (comment).
Good catch, should be fixed with latest commit.