Skip to content

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Oct 16, 2019

@corona10 corona10 changed the title bpo-38493: Add os.CLD_KILLED for posix module [WiIP]bpo-38493: Add os.CLD_KILLED for posix module Oct 16, 2019
@corona10 corona10 changed the title [WiIP]bpo-38493: Add os.CLD_KILLED for posix module [WIP]bpo-38493: Add os.CLD_KILLED for posix module Oct 16, 2019
@corona10 corona10 changed the title [WIP]bpo-38493: Add os.CLD_KILLED for posix module [WIP]bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for posix module Oct 16, 2019
@corona10 corona10 changed the title [WIP]bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for posix module bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for posix module Oct 16, 2019
@corona10 corona10 changed the title bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for posix module bpo-38493: Add os.CLD_KILLED and CLD_STOPPED for os Oct 16, 2019
@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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@corona10
Copy link
Member Author

@serhiy-storchaka
The documentation said that

These are the possible values for si_code in the result returned by waitid().

I think that checking hasattr(os, 'waitid_result') and hasattr(signal, 'SIGCHLD') for unit test
is proper.

What do you think?

@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'))
Copy link
Member

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.

@serhiy-storchaka serhiy-storchaka merged commit 2eba6ad into python:master Oct 21, 2019
@corona10 corona10 deleted the bpo-38373 branch October 21, 2019 12:19
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
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