Skip to content

bpo-39849: Fix compiler warning in _testcapimodule #19615

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

Closed
wants to merge 1 commit into from

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Apr 20, 2020

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

LGTM, I 've checked on my local machone, no warning is now showing.

@corona10
Copy link
Member

@serhiy-storchaka @vstinner Please take a look.

@corona10
Copy link
Member

@serhiy-storchaka I will merge it after my mentor's approval :) cc @vstinner

@vstinner
Copy link
Member

If I recall correctly, (void) res; doesn't silence the warning in some cases. Sorry, I don't recall in which case (which compiler, which compiler flags). Maybe it's enough for most cases.

I'm unhappy with the fix: _testcapi.test_buildvalue_issue38913() ensures that Py_BuildValue() returns NULL and raises an exception. If it's not the case, the test must fail.

For me, the assertion is part of the test and _testcapi must never be compiled without assertions.

@shihai1991: Can you please write a different PR which ensure that _testcapimodule.c and _testinternalcapi.c always enable assertions? Just put the following code at the top:

/* Always enable assertions */
#undef NDEBUG

@shihai1991
Copy link
Member Author

If I recall correctly, (void) res; doesn't silence the warning in some cases. Sorry, I don't recall in which case (which compiler, which compiler flags). Maybe it's enough for most cases.

I'm unhappy with the fix: _testcapi.test_buildvalue_issue38913() ensures that Py_BuildValue() returns NULL and raises an exception. If it's not the case, the test must fail.

For me, the assertion is part of the test and _testcapi must never be compiled without assertions.

@shihai1991: Can you please write a different PR which ensure that _testcapimodule.c and _testinternalcapi.c always enable assertions? Just put the following code at the top:

/* Always enable assertions */
#undef NDEBUG

Sure, let me try it ;)

@shihai1991
Copy link
Member Author

@vstinner Hi, victor. I enable assertions in #19623

@vstinner
Copy link
Member

@corona10: I suggest to merge PR #19623 instead, it's a more generic solution and it may help to catch more bugs in release builds. You can merge PR #19623 if you want.

@corona10 corona10 closed this Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants