[BUG] scoped redirect is crashing on windows pythonw.exe but not python.exe
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
When binding to my C++ function with py::call_guard. I'm only able to run the function from Python on Windows when I run python.exe (with the console). It crashes when I run it with pythonw.exe (hide the console, aka for desktop apps)
m.def("my_converter",
&run_my_converter,
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>(),
"run my_converter");
I've tested this on mac, linux, windows with python.exe, and pythonw.exe and the only problem I have had has been with windows and pythonw.exe
Edit:
I'm very sorry because this is a real pain to replicate since you can't reproduce this with console output to view the stacktrace.
Here's how I did it. I ran the pybind11 extension function in a try catch block and used a tkinter dialogbox to output the traceback.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sample py::call_guard using py::scoped_ostream_redirect and py::scoped_estream_redirect. Reproduce the extension call on Windows under python.exe and pythonw.exe, using the reported traceback technique if needed. Done means the binding no longer crashes under pythonw.exe and the behavior is covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend-api-design, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100