Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler error #495

Closed
brown opened this issue Feb 19, 2015 · 3 comments
Closed

compiler error #495

brown opened this issue Feb 19, 2015 · 3 comments

Comments

@brown
Copy link

brown commented Feb 19, 2015

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.

@jdavid
Copy link
Member

jdavid commented Feb 20, 2015

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.

@brown
Copy link
Author

brown commented Feb 20, 2015

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_Check

Please post the error.


Reply to this email directly or view it on GitHub
#495 (comment).

jdavid added a commit that referenced this issue Feb 20, 2015
@jdavid
Copy link
Member

jdavid commented Feb 20, 2015

Good catch, should be fixed with latest commit.

@jdavid jdavid closed this as completed Feb 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants