New submission from Steve Dower:

I'd like to enable calling CoInitializeEx on Python startup for 3.6 (and into 
the future). See 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279.aspx

This would enable us to use more advanced Windows features within Python that 
require COM, such as better integration with the shell or features such as AMSI 
(issue26137, 
https://msdn.microsoft.com/en-us/library/windows/desktop/dn889587.aspx). The 
fact that AMSI is a security feature makes it important that it be enabled by 
default and not be able to be disabled.

Calling CoInitializeEx has no impact on code that isn't already calling it, 
however, since it can only be called once per thread and you can't change the 
apartment type, it could break existing code that calls it directly (but only 
if it tries to use a different apartment type).

My proposal is to call CoInitializeEx(NULL, COINIT_MULTITHREADED) by default, 
with "-X:STA" to call CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) instead. 
(Single Threaded Apartment is the commonly used acronym for 
COINIT_APARTMENTTHREADED.) This forces the decision onto the user rather than 
letting libraries do it, but since libraries may have conflicting requirements, 
this hardly makes things worse. It also means we can rely on COM being enabled 
for any features we may want to enable within Python.

I've nosied people who I expect/hope to have an opinion, so let me know what 
you think.

----------
assignee: steve.dower
components: Windows
messages: 269537
nosy: eryksun, mhammond, paul.moore, steve.dower, tim.golden, zach.ware
priority: low
severity: normal
status: open
title: Call CoInitializeEx on startup
type: enhancement
versions: Python 3.6

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

Reply via email to