##// END OF EJS Templates
Fix to allow entering docstring into IPython....
Fix to allow entering docstring into IPython. The EscapeTransformer find method was assuming incorrectly that every line would end with either a NEWLINE or EOF, while this is not the case when encountering multiple line string. This fixes that by making sure we don't index outside of bounds. With this IPython will correctly add a newline at the CLI. Closes #11391

File last commit:

r16114:15cc5a8e
r24701:ba8538e5
Show More
hb_gil.py
31 lines | 574 B | text/x-python | PythonLexer
"""
Run this script in the qtconsole with one of:
%load hb_gil.py
or
%run hb_gil.py
Holding the GIL for too long could disrupt the heartbeat.
See Issue #1260: https://github.com/ipython/ipython/issues/1260
"""
import sys
import time
from cython import inline
def gilsleep(t):
"""gil-holding sleep with cython.inline"""
code = '\n'.join([
'from posix cimport unistd',
'unistd.sleep(t)',
])
while True:
inline(code, quiet=True, t=t)
print(time.time())
sys.stdout.flush() # this is important
gilsleep(5)