[Bf-blender-cvs] [f159ed7] master: Workaround T43491: Python readline causes crash

Campbell Barton noreply at git.blender.org
Thu Feb 26 12:55:05 CET 2015


Commit: f159ed77466fac81b7487231b5c0ed9314c250d4
Author: Campbell Barton
Date:   Thu Feb 26 22:50:29 2015 +1100
Branches: master
https://developer.blender.org/rBf159ed77466fac81b7487231b5c0ed9314c250d4

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.

===================================================================

M	release/scripts/modules/console_python.py

===================================================================

diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py
index 6695689..59e4f23 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -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"]




More information about the Bf-blender-cvs mailing list