FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-39943: Keep constness of pointers. by petdance · Pull Request #19210 · python/cpython · GitHub

Repository navigation

bpo-39943: Keep constness of pointers. - #19210

Closed
petdance wants to merge 1 commit into
python:masterfrom
petdance:cast-Python-marshal
Closed

petdance wants to merge 1 commit into
python:masterfrom
petdance:cast-Python-marshal

Conversation

petdance commented Mar 28, 2020 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor
Make two pointers be const char *.  This quiets a warning from
-Wincompatible-pointer-types.

https://bugs.python.org/issue39943

Make two pointers be const char *.  This quiets a warning from
-Wincompatible-pointer-types.

Copy link
Copy Markdown
Member

You can add const to WFILE.end, RFILE.ptr and RFILE.end.

Copy link
Copy Markdown
Contributor Author

You can add const to WFILE.end, RFILE.ptr and RFILE.end.

I'm glad to do that. I was trying to keep changes minimal, but I'll resubmit.

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I have done more cleanup in #19236.

Comment thread Python/marshal.c
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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It seems to me, that this condition is always false (see w_reserve()). So you can remove it.

Comment thread Python/marshal.c
w_object(x, &wf);
w_clear_refs(&wf);
if (wf.str != NULL) {
char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

AFAIK the cast to PyBytesObject * is not needed.

petdance deleted the cast-Python-marshal branch April 3, 2020 03:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL