Workaround T43491: Python readline causes crash

loading 'readline' module could crash blender if 'libedit' was already linked (via LLVM).

Workaround the problem for now since we don't even need readline,
a _real_ fix likely involves changing how LLVM or Python are built.
This commit is contained in:
Campbell Barton 2015-02-26 22:50:29 +11:00
parent d9fa9bffd5
commit f159ed7746
Notes: blender-bot 2023-02-14 09:33:10 +01:00
Referenced by issue #43491, Crash during autocompletion in PyConsole (Linux Library Compatibility)
1 changed files with 13 additions and 0 deletions

View File

@ -226,6 +226,8 @@ execute.hooks = []
def autocomplete(context):
_readline_bypass()
from console import intellisense
sc = context.space_data
@ -356,3 +358,14 @@ def banner(context):
sc.prompt = PROMPT
return {'FINISHED'}
# workaround for readline crashing, see: T43491
def _readline_bypass():
if "rlcompleter" in sys.modules or "readline" in sys.modules:
return
# prevent 'rlcompleter' from loading the real 'readline' module.
sys.modules["readline"] = None
import rlcompleter
del sys.modules["readline"]