Skip to content

bpo-22674: signal: add strsignal()#6017

Merged
pitrou merged 1 commit into
python:masterfrom
seirl:strsignal
Mar 12, 2018
Merged

bpo-22674: signal: add strsignal()#6017
pitrou merged 1 commit into
python:masterfrom
seirl:strsignal

Conversation

@seirl

@seirl seirl commented Mar 7, 2018

Copy link
Copy Markdown
Contributor

I updated @vajrasky 's patch in https://bugs.python.org/issue22674 to rebase it onto master, use the clinic argument parser and improve the docs.

https://bugs.python.org/issue22674

@seirl

seirl commented Mar 7, 2018

Copy link
Copy Markdown
Contributor Author

Updated with a NEWS entry.

@seirl seirl force-pushed the strsignal branch 4 times, most recently from 828fa2e to 66aa723 Compare March 8, 2018 20:30
@seirl

seirl commented Mar 8, 2018

Copy link
Copy Markdown
Contributor Author

Updated with a special case for Windows. The tests are all passing now, just waiting for a review.

Comment thread Modules/signalmodule.c Outdated

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.

According to POSIX, strsignal returns non-const char*, so let's keep it like that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't understand this one. Why would we want to keep it not const? We're not planning on modifying it, adding constness to make sure of that doesn't hurt.

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.

Py_BuildValue doesn't specify that it takes only const arguments, so you may get compiler warnings or even errors depending on compiler settings. The benefit of using const in such a simple function seem rather low, so it's better to drop it iMHO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it, I just looked at the docs of Py_Buildvalue. I fixed it, thanks.

Comment thread Modules/signalmodule.c Outdated

@pitrou pitrou Mar 11, 2018

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.

According to POSIX, you may also want to check for errno after the call (and set it to zero before).

Comment thread Modules/signalmodule.c Outdated

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.

Let's not add this kind of post-processing. If someone wants the same return values on all systems, they should simply not use strsignal at all (it's not very hard to come up with descriptions for a dozen or less well-known signals).

Comment thread Doc/library/signal.rst Outdated

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.

Please use double quotes: this is English prose, not Python :-)

Comment thread Modules/signalmodule.c Outdated

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.

Note that we indent C code by 4-space indentations, not 2. See PEP 7 for more details.

@pitrou pitrou 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.

Thanks for posting this PR! I've added some comments to the code, please make the necessary changes :-)

@bedevere-bot

Copy link
Copy Markdown

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.

And if you don't make the requested changes, you will be put in the comfy chair!

@seirl

seirl commented Mar 11, 2018

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@pitrou: please review the changes made to this pull request.

Co-authored-by: Vajrasky Kok <sky.kok@speaklikeaking.com>
@pitrou

pitrou commented Mar 12, 2018

Copy link
Copy Markdown
Member

Thank you @seirl ! This looks good to me now.

@pitrou pitrou merged commit 5d2a27d into python:master Mar 12, 2018
@bedevere-bot

Copy link
Copy Markdown

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

jo2y pushed a commit to jo2y/cpython that referenced this pull request Mar 23, 2018
Co-authored-by: Vajrasky Kok <sky.kok@speaklikeaking.com>
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.

4 participants