This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, paul.moore, srinim, steve.dower, tim.golden, vstinner, zach.ware
Date 2016-11-18.12:55:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
spawnl is implemented by calling _spawnv [1], which is documented to invoke the invalid parameter handler if argv points to a NULL pointer. It wants the program name, or whatever, as long as argv[0] isn't NULL or an empty string, e.g. `os.spawnl(os.P_NOWAIT, 'C:/Tcl/bin/tclsh.exe', 'tclsh')`. 

The invalid parameter handler should be disabled (_Py_BEGIN_SUPPRESS_IPH) when calling _spawnv[e], which in this case would lead to an EINVAL OSError instead of crashing the process. 

For example:

    import os, sys
    from ctypes import *

    ucrt = CDLL('ucrtbase')

    @CFUNCTYPE(None, c_wchar_p, c_wchar_p, c_wchar_p, c_int, c_void_p)
    def iph(*args):


    >>> os.spawnl(os.P_NOWAIT, sys.executable)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Program Files\Python35\lib\", line 977, in spawnl
        return spawnv(mode, file, args)
    OSError: [Errno 22] Invalid argument

Also, in this case a descriptive ValueError would be friendlier, given an empty argv or argv[0] that's an empty string -- at least on Windows.

Date User Action Args
2016-11-18 12:55:29eryksunsetrecipients: + eryksun, paul.moore, vstinner, tim.golden, zach.ware, steve.dower, srinim
2016-11-18 12:55:29eryksunsetmessageid: <>
2016-11-18 12:55:29eryksunlinkissue28732 messages
2016-11-18 12:55:29eryksuncreate