@@ -5166,11 +5166,11 @@ convert_sched_param(PyObject *param, struct sched_param *res);
5166
5166
#endif
5167
5167
5168
5168
static int
5169
- parse_posix_spawn_flags (PyObject * setpgroup , int resetids , int setsid , PyObject * setsigmask ,
5169
+ parse_posix_spawn_flags (const char * func_name , PyObject * setpgroup ,
5170
+ int resetids , int setsid , PyObject * setsigmask ,
5170
5171
PyObject * setsigdef , PyObject * scheduler ,
5171
5172
posix_spawnattr_t * attrp )
5172
5173
{
5173
- const char * func_name = "posix_spawnp" ;
5174
5174
long all_flags = 0 ;
5175
5175
5176
5176
errno = posix_spawnattr_init (attrp );
@@ -5400,6 +5400,7 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
5400
5400
PyObject * setpgroup , int resetids , int setsid , PyObject * setsigmask ,
5401
5401
PyObject * setsigdef , PyObject * scheduler )
5402
5402
{
5403
+ const char * func_name = use_posix_spawnp ? "posix_spawnp" : "posix_spawn" ;
5403
5404
EXECV_CHAR * * argvlist = NULL ;
5404
5405
EXECV_CHAR * * envlist = NULL ;
5405
5406
posix_spawn_file_actions_t file_actions_buf ;
@@ -5417,19 +5418,20 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
5417
5418
like posix.environ. */
5418
5419
5419
5420
if (!PyList_Check (argv ) && !PyTuple_Check (argv )) {
5420
- PyErr_SetString (PyExc_TypeError ,
5421
- "posix_spawn : argv must be a tuple or list" );
5421
+ PyErr_Format (PyExc_TypeError ,
5422
+ "%s : argv must be a tuple or list", func_name );
5422
5423
goto exit ;
5423
5424
}
5424
5425
argc = PySequence_Size (argv );
5425
5426
if (argc < 1 ) {
5426
- PyErr_SetString (PyExc_ValueError , "posix_spawn: argv must not be empty" );
5427
+ PyErr_Format (PyExc_ValueError ,
5428
+ "%s: argv must not be empty" , func_name );
5427
5429
return NULL ;
5428
5430
}
5429
5431
5430
5432
if (!PyMapping_Check (env )) {
5431
- PyErr_SetString (PyExc_TypeError ,
5432
- "posix_spawn : environment must be a mapping object" );
5433
+ PyErr_Format (PyExc_TypeError ,
5434
+ "%s : environment must be a mapping object", func_name );
5433
5435
goto exit ;
5434
5436
}
5435
5437
@@ -5438,8 +5440,8 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
5438
5440
goto exit ;
5439
5441
}
5440
5442
if (!argvlist [0 ][0 ]) {
5441
- PyErr_SetString (PyExc_ValueError ,
5442
- "posix_spawn : argv first element cannot be empty" );
5443
+ PyErr_Format (PyExc_ValueError ,
5444
+ "%s : argv first element cannot be empty", func_name );
5443
5445
goto exit ;
5444
5446
}
5445
5447
@@ -5467,8 +5469,8 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
5467
5469
file_actionsp = & file_actions_buf ;
5468
5470
}
5469
5471
5470
- if (parse_posix_spawn_flags (setpgroup , resetids , setsid , setsigmask ,
5471
- setsigdef , scheduler , & attr )) {
5472
+ if (parse_posix_spawn_flags (func_name , setpgroup , resetids , setsid ,
5473
+ setsigmask , setsigdef , scheduler , & attr )) {
5472
5474
goto exit ;
5473
5475
}
5474
5476
attrp = & attr ;
0 commit comments