From 24eaef7c220766d36eda84b073ba78af8e82673e Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Mon, 25 Mar 2019 11:29:45 +0100 Subject: Add contextlib to Preloaded Modules for Embedding with Python 2 While developing the embedding for installer support, some functionality was moved from loader.py to signature_bootstrap.py, especially a "with" statement, that needed a contextlib import. When using PyInstaller or cxFreeze, this gave a problem when running in virtualenv and Python 2. We extended the pre-loading to contextlib. It is not completely clear why Python 2 needs that and Python 3 doesn't. The problem did not show up without virtualenv. Perhaps some different installed packages have hidden that problem, because they loaded the contextlib, themselves. This does not happen with a freshly installed virtual environment. Change-Id: I2188cb67129e596f6492d0f5dc9b303a67bfe870 Reviewed-by: Friedemann Kleint Reviewed-by: Alexandru Croitor --- sources/shiboken2/shibokenmodule/__init__.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/shiboken2/shibokenmodule') diff --git a/sources/shiboken2/shibokenmodule/__init__.py.in b/sources/shiboken2/shibokenmodule/__init__.py.in index 92e469df2..066fd3584 100644 --- a/sources/shiboken2/shibokenmodule/__init__.py.in +++ b/sources/shiboken2/shibokenmodule/__init__.py.in @@ -3,7 +3,7 @@ __version_info__ = (@shiboken_MAJOR_VERSION@, @shiboken_MINOR_VERSION@, @shiboke # PYSIDE-932: Python 2 cannot import 'zipfile' for embedding while being imported, itself. # We simply pre-load all imports for the signature extension. -import sys, zipfile, base64, marshal, io +import sys, zipfile, base64, marshal, io, contextlib from .shiboken2 import * -- cgit v1.2.3