Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PySide6 test_wrap_text_basic can segfault on windows #2017

Open
itziakos opened this issue May 3, 2023 · 2 comments
Open

PySide6 test_wrap_text_basic can segfault on windows #2017

itziakos opened this issue May 3, 2023 · 2 comments

Comments

@itziakos
Copy link
Member

itziakos commented May 3, 2023

Running the PySide6 test on windows sometimes segfaults when the ~/AppData/Local/Microsoft/Windows/Explorer folder is not already populated.

The script bellow will probably segfault once every 5 times.

import os
import sys
import subprocess
from pathlib import Path

HERE = Path(__file__).parent
app_data = HERE / 'AppData'
if app_data.exists(): 
    shutil.rmtree(app_data)

env = os.environ.copy()
env['USERPROFILE'] = str(HERE)
env['HOME'] = str(HERE)
env["ETS_TOOLKIT"] = "qt"
env["QT_API"] = "pyside6"
env["EXCLUDE_TESTS"] = "wx"

cmd =  [sys.executable, "-X", "faulthandler", "-m", "unittest", "discover", "traitsui"],
subprocess.run(cmd, env=env)

The segfault is

test_qobject_is_valid (traitsui.qt4.tests.test_helper.TestWrapText) ... ok
test_wrap_text_basic (traitsui.qt4.tests.test_helper.TestWrapText) ... QGuiApplication::font(): no QGuiApplication instance and no application font set.
QFont::setPointSize: Point size <= 0 (-1), must be greater than 0
QGuiApplication::font(): no QGuiApplication instance and no application font set.
Windows fatal exception: access violation

Current thread 0x00002468 (most recent call first):
  File "c:\Users\template\.edm\envs\build-env\lib\site-packages\traitsui\qt4\tests\test_helper.py", line 50 in test_wrap_text_basic
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\case.py", line 633 in _callTestMethod
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\case.py", line 676 in run
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\case.py", line 736 in __call__
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 122 in run
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 84 in __call__
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 122 in run
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 84 in __call__
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 122 in run
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 84 in __call__
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 122 in run
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\suite.py", line 84 in __call__
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\runner.py", line 176 in run
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\main.py", line 271 in runTests
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\main.py", line 101 in __init__
  File "c:\Users\template\.edm\envs\build-env\lib\unittest\__main__.py", line 18 in <module>
  File "c:\Users\template\.edm\envs\build-env\lib\runpy.py", line 87 in _run_code
  File "c:\Users\template\.edm\envs\build-env\lib\runpy.py", line 194 in _run_module_as_main
FAIL

Environment:

  • EDM cp38 Windows 10 64bit
  • PySide6 6.2.3-7
  • traitsui 7.4.3
@itziakos
Copy link
Member Author

itziakos commented May 3, 2023

Update: The bug might not be always easy to reproduce and I am starting to doupt the relation with AppData.

@itziakos itziakos changed the title PySide6 tests can segfault on windows PySide6 test_wrap_text_basic can segfault on windows May 3, 2023
@corranwebster
Copy link
Contributor

Possible direction to explore - this test is using "Courier" font. I think Qt may play games with Courier:

In Windows a request for the "Courier" font is automatically changed to "Courier New", an improved version of Courier that allows for smooth scaling. The older "Courier" bitmap font can be selected by setting the PreferBitmap style strategy (see setStyleStrategy()).

Possibly related in some way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants