diff options
author | gatecat <gatecat@ds0.me> | 2021-02-22 10:48:21 +0000 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-02-22 10:48:21 +0000 |
commit | 3b451743753fc99d56e424d04f810c59acd33968 (patch) | |
tree | 50e375e76a50a99576e385b01f6f47cb95769372 /3rdparty | |
parent | c0a7cff3048f51855b1df14c6d1c2b3ad200a713 (diff) | |
download | nextpnr-3b451743753fc99d56e424d04f810c59acd33968.tar.gz nextpnr-3b451743753fc99d56e424d04f810c59acd33968.tar.bz2 nextpnr-3b451743753fc99d56e424d04f810c59acd33968.zip |
pyconsole: Avoid lockup when reading from stdin
Create an empty temporary file for stdin; so reads fail rather than
locking up (otherwise doing help() would be enough to completely lock up
the GUI).
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to '3rdparty')
-rw-r--r-- | 3rdparty/python-console/modified/pyinterpreter.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/3rdparty/python-console/modified/pyinterpreter.cc b/3rdparty/python-console/modified/pyinterpreter.cc index c222c9ad..99b8883e 100644 --- a/3rdparty/python-console/modified/pyinterpreter.cc +++ b/3rdparty/python-console/modified/pyinterpreter.cc @@ -133,8 +133,10 @@ void pyinterpreter_initialize() PyRun_SimpleString("import sys\n" "import redirector\n" + "import tempfile\n" "sys.path.insert(0, \".\")\n" // add current path "sys.stdout = redirector.redirector()\n" + "sys.stdin = tempfile.TemporaryFile(mode='r')\n" "sys.stderr = sys.stdout\n" "import rlcompleter\n" "sys.completer = rlcompleter.Completer()\n"); |