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 zach.ware
Recipients brett.cannon, eryksun, mhammond, nnemkin, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-06-30.16:25:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1467303905.16.0.165354937365.issue27417@psf.upfronthosting.co.za>
In-reply-to
Content
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!
History
Date User Action Args
2016-06-30 16:25:05zach.waresetrecipients: + zach.ware, mhammond, brett.cannon, paul.moore, tim.golden, eryksun, steve.dower, nnemkin
2016-06-30 16:25:05zach.waresetmessageid: <1467303905.16.0.165354937365.issue27417@psf.upfronthosting.co.za>
2016-06-30 16:25:05zach.warelinkissue27417 messages
2016-06-30 16:25:05zach.warecreate