This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author petdance
Recipients methane, petdance, serhiy.storchaka, vstinner
Date 2020-03-27.15:14:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Casting tail to (void *)tail was the correct thing to do.  The problem is that casting to void* casts away the constness of tail.  The even more correct thing to do is what my patch does, which is cast it to (const void *)tail.

There is no functional difference between sending a const void * and a void * to fprintf.  However, it's one more bit of noise for -Wcast-qual to gripe about.  My hope is to clear up the noise to find the real problems.

For example, if you had this very bad code:

    const char *msg = "literal";
    strcpy(msg, "another string");

then the compiler would complain you're passing a non-const char * to the first arg of strcpy that wants a const char *.  That's a good thing.

However, you could naively change that to:

    strcpy((char *)msg, "another string");

and that would compile just fine, but the code would still be a big problem. It would require -Wcast-qual to warn you that you're casting away the constness of a pointer.


For pymemallocator_eq, changing the arguments to const doesn't quiet any warnings in this case with this one function.  However, it's good to make them const because the arguments are not getting modified.  They're getting passed to memcmp(), which properly takes const void *.
Date User Action Args
2020-03-27 15:14:42petdancesetrecipients: + petdance, vstinner, methane, serhiy.storchaka
2020-03-27 15:14:42petdancesetmessageid: <>
2020-03-27 15:14:42petdancelinkissue39943 messages
2020-03-27 15:14:42petdancecreate