aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-02-22 10:48:21 +0000
committergatecat <gatecat@ds0.me>2021-02-22 10:48:21 +0000
commit3b451743753fc99d56e424d04f810c59acd33968 (patch)
tree50e375e76a50a99576e385b01f6f47cb95769372 /3rdparty
parentc0a7cff3048f51855b1df14c6d1c2b3ad200a713 (diff)
downloadnextpnr-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.cc2
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");