Segev Finer added the comment:
I have read some of https://github.com/rprichard/win32-console-docs and it
documents quite a bunch of nastiness with PROC_THREAD_ATTRIBUTE_HANDLE_LIST in
Windows Vista/7. Windows is so much fun sometimes :P
Essentially console handles in Windows before Windows 8 are user mode handles
and not real kernel handles. Those user mode handles are inherited by a
different mechanism than kernel handles and regardless of
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, and if passed in
PROC_THREAD_ATTRIBUTE_HANDLE_LIST will cause it to fail in weird ways. Those
user mode console handles have the lower two bits set. The lower two bits in
Windows are reserved for tagging such special handles.
Also in all versions you can't pass in an empty handle list, but a list with
just a NULL handle works fine.
I attached a version of the patch with a hack around those issues based on what
I read, but I can't test that it actually fixes the issues since I don't have a
Windows Vista or 7 system around.
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list