Skip to content

Commit 3eed19c

Browse files
committed
Fix setRedirectStdInCallbackEnabled
This changes the conditions in setRedirectStdInCallbackEnabled to correctly check for the presence of 'pythonqt_stdin' and 'pythonqt_original_stdin' attributes. This ensures proper redirection of stdin. (cherry picked from commit commontk/PythonQt@ddecb44)
1 parent 86eb0eb commit 3eed19c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PythonQt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,11 @@ void PythonQt::setRedirectStdInCallbackEnabled(bool enabled)
502502
sys.setNewRef(PyImport_ImportModule("sys"));
503503

504504
if (enabled) {
505-
if( !PyObject_HasAttrString(sys.object(), "pythonqt_stdin") ) {
505+
if( PyObject_HasAttrString(sys.object(), "pythonqt_stdin") ) {
506506
PyObject_SetAttrString(sys.object(), "stdin", PyObject_GetAttrString(sys.object(), "pythonqt_stdin"));
507507
}
508508
} else {
509-
if( !PyObject_HasAttrString(sys.object(), "pythonqt_original_stdin") ) {
509+
if( PyObject_HasAttrString(sys.object(), "pythonqt_original_stdin") ) {
510510
PyObject_SetAttrString(sys.object(), "stdin", PyObject_GetAttrString(sys.object(), "pythonqt_original_stdin"));
511511
}
512512
}

0 commit comments

Comments
 (0)