diff options
author | Christian Tismer <tismer@stackless.com> | 2019-03-01 15:18:45 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-03-01 14:48:15 +0000 |
commit | 54f48761deba04f8ac68b601894d31bdabee3fd6 (patch) | |
tree | 85d0f73a38ff5691f684839eeed2d08d43c0fb77 | |
parent | 8aa9cdf783e926e9d9a5543b77a54d3a34e90782 (diff) |
Amend The Python 3.5 Fix
After the bug found in PYSIDE-928, the contextlib problem of
Python 3.5 also vanished.
What remains is the crash on shutdown which is caused by
module 'testbinding'.
Task-number: PYSIDE-953
Change-Id: I07f18fa468fdb0758ee4e4b7663c3a42bec42822
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
6 files changed, 3 insertions, 25 deletions
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py index 21ef841fe..a92ee76f0 100644 --- a/sources/pyside2/PySide2/support/generate_pyi.py +++ b/sources/pyside2/PySide2/support/generate_pyi.py @@ -53,13 +53,6 @@ import re import subprocess import argparse import glob -# PYSIDE-953: Use a newer contextlib for Python 3.5 -skip_creation = False -if sys.version_info[:2] == (3, 5): - try: - import PySide2.support.signature # gets new contextlib - except: - skip_creation = True from contextlib import contextmanager from textwrap import dedent @@ -279,9 +272,6 @@ def single_process(lockdir): def generate_all_pyi(outpath, options): - if skip_creation: - logger.warn("Sorry, we cannot create .pyi files with Python 3.5 while PySide") - logger.warn(" is not installed. Please run it by hand!") ps = os.pathsep if options.sys_path: # make sure to propagate the paths from sys_path to subprocesses diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py index 6031dd2ad..a324c36a2 100644 --- a/sources/pyside2/tests/registry/init_platform.py +++ b/sources/pyside2/tests/registry/init_platform.py @@ -55,8 +55,7 @@ shiboken and pysidetest projects. import sys import os import re -# PYSIDE-953: Use a newer contextlib for Python 3.5 -# from contextlib import contextmanager +from contextlib import contextmanager from textwrap import dedent script_dir = os.path.normpath(os.path.join(__file__, *".. .. .. .. ..".split())) @@ -118,9 +117,6 @@ sys.path[:0] = [os.path.join(shiboken_build_dir, "shibokenmodule"), pyside_build_dir] import PySide2 -# PYSIDE-953: Use a newer contextlib for Python 3.5 -import PySide2.support.signature # new contextlib -from contextlib import contextmanager all_modules = list("PySide2." + x for x in PySide2.__all__) diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index f2112e34f..e284c6a54 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -5536,7 +5536,7 @@ bool CppGenerator::finishGeneration() if (usePySideExtensions()) { s << "void cleanTypesAttributes(void) {" << endl; s << INDENT << "if (PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03060000)" << endl; - s << INDENT << " return; // testbinding crashes in Python 3.5 when hasattr touches types!" << endl; + s << INDENT << " return; // PYSIDE-953: testbinding crashes in Python 3.5 when hasattr touches types!" << endl; s << INDENT << "for (int i = 0, imax = SBK_" << moduleName() << "_IDX_COUNT; i < imax; i++) {" << endl; { Indentation indentation(INDENT); diff --git a/sources/shiboken2/shibokenmodule/CMakeLists.txt b/sources/shiboken2/shibokenmodule/CMakeLists.txt index 952d31994..b37d0c941 100644 --- a/sources/shiboken2/shibokenmodule/CMakeLists.txt +++ b/sources/shiboken2/shibokenmodule/CMakeLists.txt @@ -70,10 +70,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/lib/__init__.py" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/lib/enum_sig.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/lib/enum_sig.py" COPYONLY) if (PYTHON_VERSION_MAJOR EQUAL 3) - if (PYTHON_VERSION_MINOR EQUAL 5) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/contextlib36.py" - "${CMAKE_CURRENT_BINARY_DIR}/support/signature/contextlib36.py" COPYONLY) - endif() else() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/backport_inspect.py" "${CMAKE_CURRENT_BINARY_DIR}/support/signature/backport_inspect.py" COPYONLY) diff --git a/sources/shiboken2/shibokenmodule/support/signature/fix-complaints.py b/sources/shiboken2/shibokenmodule/support/signature/fix-complaints.py index ef18beb67..cdd84f9be 100644 --- a/sources/shiboken2/shibokenmodule/support/signature/fix-complaints.py +++ b/sources/shiboken2/shibokenmodule/support/signature/fix-complaints.py @@ -49,7 +49,7 @@ you are changing messages (what I did, of course :-) . import os -patched_modules = "backport_inspect typing27 contextlib36" +patched_modules = "backport_inspect typing27" offending_words = { "behavio""ur": "behavior", diff --git a/sources/shiboken2/shibokenmodule/support/signature/loader.py b/sources/shiboken2/shibokenmodule/support/signature/loader.py index 749229c3b..458759845 100644 --- a/sources/shiboken2/shibokenmodule/support/signature/loader.py +++ b/sources/shiboken2/shibokenmodule/support/signature/loader.py @@ -158,10 +158,6 @@ with ensure_import_support(): import typing import inspect inspect.formatannotation = formatannotation - if sys.version_info[:2] == (3, 5): - # PYSIDE-953: Use a newer contextlib. - from support.signature import contextlib36 as contextlib - sys.modules["contextlib"] = contextlib else: import inspect namespace = inspect.__dict__ |