Skip to content

Conversation

@matrixise
Copy link
Member

@matrixise matrixise commented Jan 29, 2018

Fix the warnings in the new Python/ast_unparse.c file

https://bugs.python.org/issue32711

@matrixise matrixise force-pushed the bpo-32711_fix_warnings_in_python_astunparse branch from 351f1a3 to 4c41d41 Compare January 29, 2018 13:54
@matrixise
Copy link
Member Author

with the help of @tiran I have modified my commit and fix all the warnings in Python/ast_unparse.c

Copy link
Member

@tiran tiran left a 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.

Copy link
Member

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.

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@matrixise matrixise force-pushed the bpo-32711_fix_warnings_in_python_astunparse branch from 4c41d41 to e97538a Compare January 29, 2018 15:36
Fix the warnings in the new Python/ast_unparse.c file
@matrixise matrixise force-pushed the bpo-32711_fix_warnings_in_python_astunparse branch from e97538a to dff6d17 Compare January 29, 2018 15:39
@matrixise
Copy link
Member Author

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 skip news label on this PR.

@vstinner vstinner requested a review from ambv January 29, 2018 21:29
case FloorDiv: op = " // "; break;
case Pow: op = " ** "; break;
default:
PyErr_SetString(PyExc_SystemError,
Copy link
Member

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?

default:
PyErr_SetString(PyExc_SystemError,
"unknown operator inside f-string");
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Ditto: Py_UNREACHABLE()?

Copy link
Member Author

@matrixise matrixise Jan 29, 2018

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()

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, I do understand ;-)

@vstinner
Copy link
Member

@ambv: would you mind to have a look?

@matrixise
Copy link
Member Author

@ambv just a small ping/pong for the status of this PR.

@matrixise
Copy link
Member Author

cool and now, who wants to have the responsibility of the merge for this PR ? ;-)

@tiran tiran merged commit 83ab995 into python:master Feb 1, 2018
@miss-islington
Copy link
Contributor

Thanks @matrixise for the PR, and @tiran for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

@tiran: Please replace # with GH- in the commit message next time. Thanks!

@bedevere-bot
Copy link

GH-5475 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 1, 2018
* bpo-32711: Fix warnings for Python/ast_unparse.c
(cherry picked from commit 83ab995)

Co-authored-by: Stéphane Wirtel <[email protected]>
tiran pushed a commit that referenced this pull request Feb 1, 2018
* bpo-32711: Fix warnings for Python/ast_unparse.c
(cherry picked from commit 83ab995)

Co-authored-by: Stéphane Wirtel <[email protected]>
@ambv
Copy link
Contributor

ambv commented Feb 1, 2018

Sorry, was slammed this week. Thanks for fixing so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants