Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Sep 11, 2017

Fix Coverity CID 1417587: _PyMem_Initialize() contains code which is
never executed.

https://bugs.python.org/issue30860

@vstinner
Copy link
Member Author

I'm not sure why this change is needed since Include/internal/pymalloc.h contains:

#if NB_SMALL_SIZE_CLASSES > 64
#error "NB_SMALL_SIZE_CLASSES should be less than 64"
#endif /* NB_SMALL_SIZE_CLASSES > 64 */

So the code is already dead code? Maybe the code should be removed, but add a comment to Include/internal/pymalloc.h to ask to update _PyMem_Initialize() if NB_SMALL_SIZE_CLASSES becomes larger than 64?

@ericsnowcurrently
Copy link
Member

So is coverity not smart enough to figure out the check across files? Or perhaps the coverity whitelist needs to be updated?

Fix Coverity CID 1417587: _PyMem_Initialize() contains code which is
never executed.

Replace the runtime check with a build assertion.
@vstinner
Copy link
Member Author

I rewrote the PR to remove the deadcode. I added a build assertion as a reminder to update the code if NB_SMALL_SIZE_CLASSES is modified.

@vstinner vstinner merged commit ccb3c76 into python:master Sep 14, 2017
@vstinner vstinner deleted the pymem_deadcode branch September 14, 2017 21:48
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.

5 participants