Skip to content

bpo-30911: Fix warning in _json.c due to char being unsigned on some platforms #2684

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

Merged
merged 3 commits into from
Jul 13, 2017

Conversation

segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Jul 12, 2017

From buildbots:

/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Modules/_json.c: In function ‘scanner_new’:
/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Modules/_json.c:1212:5: warning: comparison is always false due to limited range of data type [-Wtype-limits]
     if (s->strict < 0)
     ^

This means that the error check doesn't work right. Note that I didn't test this.

@mention-bot
Copy link

@segevfiner, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @pitrou and @loewis to be potential reviewers.

@segevfiner segevfiner changed the title trivial: Fix warning in _json.c due to char being unsigned on some platforms bpo-30911: Fix warning in _json.c due to char being unsigned on some platforms Jul 12, 2017
Modules/_json.c Outdated
@@ -18,7 +18,7 @@ static PyTypeObject PyEncoderType;

typedef struct _PyScannerObject {
PyObject_HEAD
char strict;
int strict;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T_BOOL below requires a field of type char.

@serhiy-storchaka
Copy link
Member

I think you could just use signed char.

@segevfiner
Copy link
Contributor Author

segevfiner commented Jul 12, 2017

I just hope this doesn't end up triggering a signed/unsigned mismatch warning somewhere else 😛

Bug Toggle GIF

@serhiy-storchaka serhiy-storchaka merged commit 541bd28 into python:master Jul 13, 2017
@segevfiner segevfiner deleted the patch-2 branch July 13, 2017 08:10
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

Successfully merging this pull request may close these issues.

4 participants