aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/shibokenmodule
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-03-25 11:29:45 +0100
committerChristian Tismer <tismer@stackless.com>2019-03-25 12:49:56 +0000
commit24eaef7c220766d36eda84b073ba78af8e82673e (patch)
tree1024e417baea121818b61f9af86778022d3f5a93 /sources/shiboken2/shibokenmodule
parent7539ef50f0755f89e9307d036cf4cc63bbf79e3a (diff)
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 <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/shibokenmodule')
-rw-r--r--sources/shiboken2/shibokenmodule/__init__.py.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/sources/shiboken2/shibokenmodule/__init__.py.in b/sources/shiboken2/shibokenmodule/__init__.py.in
index 92e469df..066fd358 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 *