Bernt Røskar Brenna added the comment:

And here's a function that does not require pywin32:

def open_noinherit_ctypes(*args, **kwargs):
    HANDLE_FLAG_INHERIT = 1

    import msvcrt
    from ctypes import windll, WinError
    fp = open(*args, **kwargs)
    if not 
windll.kernel32.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()), 
HANDLE_FLAG_INHERIT, 0):
        raise WinError()
    return fp

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19575>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to