@@ -7155,6 +7155,7 @@ parse_posix_spawn_flags(PyObject *module, const char *func_name, PyObject *setpg
71557155 PyObject * setsigdef , PyObject * scheduler ,
71567156 posix_spawnattr_t * attrp )
71577157{
7158+ assert (scheduler == NULL || scheduler == Py_None || PyTuple_Check (scheduler ));
71587159 long all_flags = 0 ;
71597160
71607161 errno = posix_spawnattr_init (attrp );
@@ -7163,7 +7164,7 @@ parse_posix_spawn_flags(PyObject *module, const char *func_name, PyObject *setpg
71637164 return -1 ;
71647165 }
71657166
7166- if (setpgroup ) {
7167+ if (setpgroup && setpgroup != Py_None ) {
71677168 pid_t pgid = PyLong_AsPid (setpgroup );
71687169 if (pgid == (pid_t )- 1 && PyErr_Occurred ()) {
71697170 goto fail ;
@@ -7236,7 +7237,7 @@ parse_posix_spawn_flags(PyObject *module, const char *func_name, PyObject *setpg
72367237 }
72377238#endif
72387239
7239- if (scheduler ) {
7240+ if (scheduler && scheduler != Py_None ) {
72407241#ifdef POSIX_SPAWN_SETSCHEDULER
72417242 PyObject * py_schedpolicy ;
72427243 PyObject * schedparam_obj ;
@@ -7461,6 +7462,12 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
74617462 goto exit ;
74627463 }
74637464
7465+ if (scheduler && !PyTuple_Check (scheduler ) && scheduler != Py_None ) {
7466+ PyErr_Format (PyExc_TypeError ,
7467+ "%s: scheduler must be a tuple or None" , func_name );
7468+ goto exit ;
7469+ }
7470+
74647471 argvlist = parse_arglist (argv , & argc );
74657472 if (argvlist == NULL ) {
74667473 goto exit ;
@@ -7572,7 +7579,7 @@ os.posix_spawn
75727579 *
75737580 file_actions: object(c_default='NULL') = ()
75747581 A sequence of file action tuples.
7575- setpgroup: object = NULL
7582+ setpgroup: object(c_default='NULL') = None
75767583 The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
75777584 resetids: bool = False
75787585 If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
@@ -7582,7 +7589,7 @@ os.posix_spawn
75827589 The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
75837590 setsigdef: object(c_default='NULL') = ()
75847591 The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
7585- scheduler: object = NULL
7592+ scheduler: object(c_default='NULL') = None
75867593 A tuple with the scheduler policy (optional) and parameters.
75877594
75887595Execute the program specified by path in a new process.
@@ -7594,7 +7601,7 @@ os_posix_spawn_impl(PyObject *module, path_t *path, PyObject *argv,
75947601 PyObject * setpgroup , int resetids , int setsid ,
75957602 PyObject * setsigmask , PyObject * setsigdef ,
75967603 PyObject * scheduler )
7597- /*[clinic end generated code: output=14a1098c566bc675 input=808aed1090d84e33 ]*/
7604+ /*[clinic end generated code: output=14a1098c566bc675 input=69e7c9ebbdcf94a5 ]*/
75987605{
75997606 return py_posix_spawn (0 , module , path , argv , env , file_actions ,
76007607 setpgroup , resetids , setsid , setsigmask , setsigdef ,
@@ -7618,7 +7625,7 @@ os.posix_spawnp
76187625 *
76197626 file_actions: object(c_default='NULL') = ()
76207627 A sequence of file action tuples.
7621- setpgroup: object = NULL
7628+ setpgroup: object(c_default='NULL') = None
76227629 The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
76237630 resetids: bool = False
76247631 If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
@@ -7628,7 +7635,7 @@ os.posix_spawnp
76287635 The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
76297636 setsigdef: object(c_default='NULL') = ()
76307637 The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
7631- scheduler: object = NULL
7638+ scheduler: object(c_default='NULL') = None
76327639 A tuple with the scheduler policy (optional) and parameters.
76337640
76347641Execute the program specified by path in a new process.
@@ -7640,7 +7647,7 @@ os_posix_spawnp_impl(PyObject *module, path_t *path, PyObject *argv,
76407647 PyObject * setpgroup , int resetids , int setsid ,
76417648 PyObject * setsigmask , PyObject * setsigdef ,
76427649 PyObject * scheduler )
7643- /*[clinic end generated code: output=7b9aaefe3031238d input=9e89e616116752a1 ]*/
7650+ /*[clinic end generated code: output=7b9aaefe3031238d input=a5c057527c6881a5 ]*/
76447651{
76457652 return py_posix_spawn (1 , module , path , argv , env , file_actions ,
76467653 setpgroup , resetids , setsid , setsigmask , setsigdef ,
0 commit comments