python / python/cpython

Qt causes Python's Py_Main to no-op on Windows

Open
#93,013 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-windows type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

There is a a very weird bug with Python 3.10.4 and Qt (both 5.15.2 and 6.3.0) such that if you reference any non-trivial Qt classes or methods (such as qIsFinite, QString, or QVector) on Windows, trying to call Py_Main (or Py_BytesMain) will result in a no-op (the program will immediately exit 0 and not show the Python interactive shell). Furthermore, the bug is absent on MacOS. I have linked a minimal example of the bug at https://github.com/Landmaster/python-embed-qt-bug. The corresponding bug report on the QT side is at https://bugreports.qt.io/browse/QTBUG-103734.

Your environment

  • CPython versions tested on: 3.10.4
  • Operating system and architecture: Windows 11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal example on Windows 11 using CPython 3.10.4 and Qt 5.15.2 or 6.3.0, comparing Py_Main and Py_BytesMain with and without non-trivial Qt references. Read the linked QTBUG-103734 report and determine the cause; done means the embedded program no longer exits silently instead of showing the interactive shell.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.