-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-39943: Keep constness of pointers. #19210
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
Conversation
Make two pointers be const char *. This quiets a warning from -Wincompatible-pointer-types.
You can add |
I'm glad to do that. I was trying to keep changes minimal, but I'll resubmit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have done more cleanup in #19236.
@@ -1598,7 +1598,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version) | |||
w_object(x, &wf); | |||
w_clear_refs(&wf); | |||
if (wf.str != NULL) { | |||
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); | |||
const char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); | |||
if (wf.ptr - base > PY_SSIZE_T_MAX) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me, that this condition is always false (see w_reserve()
). So you can remove it.
@@ -1598,7 +1598,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version) | |||
w_object(x, &wf); | |||
w_clear_refs(&wf); | |||
if (wf.str != NULL) { | |||
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK the cast to PyBytesObject *
is not needed.
https://bugs.python.org/issue39943