Skip to content

Commit e8575c7

Browse files
committed
Warn when IPython < 7.0
1 parent 8081e13 commit e8575c7

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/replhelper/core.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import print_function
22

3+
import warnings
34
import sys
45

56

@@ -146,8 +147,24 @@ def ipython_options(**kwargs):
146147
return dict(user_ns=user_ns, config=c)
147148

148149

150+
segfault_warning = """\
151+
Segmentation fault warning.
152+
153+
You are using IPython version {IPython.__version__} which is known to
154+
cause segmentation fault with tab completion. For segfault-free
155+
IPython, upgrade to version 7 or above (which may still be in
156+
development stage depending on the time you read this message).
157+
"""
158+
159+
segfault_warned = False
160+
161+
149162
@print_instruction_on_import_error
150163
def customized_ipython(**kwargs):
164+
global segfault_warned
151165
import IPython
152166
print()
167+
if int(IPython.__version__.split('.', 1)[0]) < 7 and not segfault_warned:
168+
warnings.warn(segfault_warning.format(**vars()))
169+
segfault_warned = True
153170
IPython.start_ipython(**ipython_options(**kwargs))

0 commit comments

Comments
 (0)