-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for os #16821
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
Misc/NEWS.d/next/Library/2019-10-16-19-56-51.bpo-38373.86ExWB.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Library/2019-10-16-19-56-51.bpo-38373.86ExWB.rst
Outdated
Show resolved
Hide resolved
Lib/test/test_posix.py
Outdated
@unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal') | ||
@unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result") | ||
def test_cld_xxxx_constants(self): | ||
# reference: http://man7.org/linux/man-pages/man2/sigaction.2.html |
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.
These names are not Linux specific, and on other OSes they can have other values.
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.
These names are not Linux specific, and on other OSes they can have other values.
I 've updated the unit test.
Please let me know if you have better ideas.
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.
Linux: http://man7.org/linux/man-pages/man2/sigaction.2.html
BSD: https://www.freebsd.org/cgi/man.cgi?query=siginfo&sektion=3&apropos=0&manpath=FreeBSD+7.1-RELEASE
Apple: https://opensource.apple.com/source/xnu/xnu-344/bsd/sys/signal.h
Is it enough to check hasattr(signal, 'SIGCHLD')
?
@serhiy-storchaka
I think that checking hasattr(os, 'waitid_result') and hasattr(signal, 'SIGCHLD') for unit test What do you think? |
Lib/test/test_posix.py
Outdated
@unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal') | ||
@unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result") | ||
def test_cld_xxxx_constants(self): | ||
self.assertTrue(hasattr(os, 'CLD_EXITED')) |
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 is enough to just get an attribute:
os.CLD_EXITED
These constants are a part of Posix, but I am not sure that they are implemented in all Unixes (as you see, some was not implemented in old Linux). In particularly, I have doubts about AIX. But let try.
https://bugs.python.org/issue38493