Skip to content

fix: prevent crash when calling pybind11::print in a subsystem:windows build#6012

Open
oxine wants to merge 2 commits intopybind:masterfrom
oxine:master
Open

fix: prevent crash when calling pybind11::print in a subsystem:windows build#6012
oxine wants to merge 2 commits intopybind:masterfrom
oxine:master

Conversation

@oxine
Copy link

@oxine oxine commented Mar 25, 2026

fix: prevent crash when calling pybind11::print in a subsystem:windows build

Description

Calling pybind11::print() crash in MSVC v19.44 with /subsystem:windows given.

In line: file = module_::import("sys").attr("stdout"); the file will be none in a windows application build. won't be catched since there's no exception, and crashed in later access.

Add check before accessing file to prevent crash.

oxine added 2 commits March 25, 2026 20:56
in line: file = module_::import("sys").attr("stdout");   the file will be none in a windows application build. won't be catched since there's no exception, and crashed in later access
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

Successfully merging this pull request may close these issues.

1 participant