[issue27417] Call CoInitializeEx on startup

Zachary Ware report at bugs.python.org
Thu Jun 30 12:25:05 EDT 2016


Zachary Ware added the comment:

What about instead of unconditionally calling CoInitializeEx in all cases, add a Py_EnsureCOM(flags) C API function?  The flags param would be any flags that the caller must have, would default to 0, and would be combined with sys.coinit_flags before calling CoInitializeEx.  If CoInitializeEx had already been called, the flags are compared with what were used in the call and an error is raised in case of conflict.  Otherwise, CoInitializeEx is called and the flags are returned.  It could also be exposed to Python code as sys.ensure_com, though in the case of something like AMSI being enabled, sys.ensure_com would always either be a no-op or raise an error.


Disclaimer: I know exactly nothing about COM, except what I've read in this issue and the AMSI issue.  If this suggestion is unworkable, please ignore it entirely!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27417>
_______________________________________


More information about the Python-bugs-list mailing list