-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-32711: Fix warnings for Python/ast_unparse.c #5426
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
bpo-32711: Fix warnings for Python/ast_unparse.c #5426
Conversation
351f1a3 to
4c41d41
Compare
|
with the help of @tiran I have modified my commit and fix all the warnings in |
tiran
left a comment
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.
Rather then setting op to NULL, please modify the switch block. You either have to default: op = ""; break; or raise an exception and return -1.
Python/ast_unparse.c
Outdated
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.
You cannot pass NULL to append_charp because _PyUnicodeWriter_WriteASCIIString doesn't handle NULL as second argument.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
4c41d41 to
e97538a
Compare
Fix the warnings in the new Python/ast_unparse.c file
e97538a to
dff6d17
Compare
|
I would like to be sure, for a fix as this one, do we need to add a News file ? maybe we could add a |
Python/ast_unparse.c
Outdated
| case FloorDiv: op = " // "; break; | ||
| case Pow: op = " ** "; break; | ||
| default: | ||
| PyErr_SetString(PyExc_SystemError, |
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.
If this case cannot happen, maybe Py_UNREACHABLE(); is enough here?
Python/ast_unparse.c
Outdated
| default: | ||
| PyErr_SetString(PyExc_SystemError, | ||
| "unknown operator inside f-string"); | ||
| return -1; |
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.
Ditto: Py_UNREACHABLE()?
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.
in the default ? ok, Py_UNREACHABLE() is a macro for abort()
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.
yes. instead of PyErr_SetString()+return -1. But it's an open question, I don't know if if's safe. That's why I asked @ambv to take a look.
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.
yep, I do understand ;-)
|
@ambv: would you mind to have a look? |
|
@ambv just a small ping/pong for the status of this PR. |
|
cool and now, who wants to have the responsibility of the merge for this PR ? ;-) |
|
Thanks @matrixise for the PR, and @tiran for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
@tiran: Please replace |
|
GH-5475 is a backport of this pull request to the 3.7 branch. |
* bpo-32711: Fix warnings for Python/ast_unparse.c (cherry picked from commit 83ab995) Co-authored-by: Stéphane Wirtel <[email protected]>
|
Sorry, was slammed this week. Thanks for fixing so quickly! |
Fix the warnings in the new Python/ast_unparse.c file
https://bugs.python.org/issue32711