From eeaa4251234cfbbefc8f24e7cba22d330d98eefc Mon Sep 17 00:00:00 2001 From: Cosmin Poieana Date: Fri, 16 Oct 2015 20:29:50 +0300 Subject: [PATCH] Make the multithreaded coinitialize only on 64bit Change-Id: I5d44efb634051f00cd3ca54b99ce0dea806543be --- cloudbaseinit/shell.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cloudbaseinit/shell.py b/cloudbaseinit/shell.py index 02d11814..ba08c723 100644 --- a/cloudbaseinit/shell.py +++ b/cloudbaseinit/shell.py @@ -12,11 +12,15 @@ # License for the specific language governing permissions and limitations # under the License. +import struct import sys -import pythoncom -sys.coinit_flags = pythoncom.COINIT_MULTITHREADED -pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) +if struct.calcsize("P") == 8 and sys.platform == 'win32': + # This is needed by Nano Server. + # Set COINIT_MULTITHREADED only on x64 interpreters due to issues on x86. + import pythoncom + sys.coinit_flags = pythoncom.COINIT_MULTITHREADED + pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) from oslo_config import cfg from oslo_log import log as oslo_logging