Skip to content

Commit de50aad

Browse files
jcfrusiems
authored andcommitted
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 333b355 commit de50aad

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
@@ -505,11 +505,11 @@ void PythonQt::setRedirectStdInCallbackEnabled(bool enabled)
505505
sys.setNewRef(PyImport_ImportModule("sys"));
506506

507507
if (enabled) {
508-
if( !PyObject_HasAttrString(sys.object(), "pythonqt_stdin") ) {
508+
if( PyObject_HasAttrString(sys.object(), "pythonqt_stdin") ) {
509509
PyObject_SetAttrString(sys.object(), "stdin", PyObject_GetAttrString(sys.object(), "pythonqt_stdin"));
510510
}
511511
} else {
512-
if( !PyObject_HasAttrString(sys.object(), "pythonqt_original_stdin") ) {
512+
if( PyObject_HasAttrString(sys.object(), "pythonqt_original_stdin") ) {
513513
PyObject_SetAttrString(sys.object(), "stdin", PyObject_GetAttrString(sys.object(), "pythonqt_original_stdin"));
514514
}
515515
}

0 commit comments

Comments
 (0)