From d8478d671d526acc62944d3df949e3243cf9b41c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 21 Jan 2019 07:50:48 +0000 Subject: [PATCH] Fix segfault using -python -noproxy and %pythonbegin --- Source/Modules/python.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index fe681f768..5ec9cf3d7 100755 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -5011,9 +5011,11 @@ public: Delete(pycode); } } else if (!ImportMode && (Cmp(section, "pythonbegin") == 0)) { - String *pycode = indent_pythoncode(code, "", Getfile(n), Getline(n), "%pythonbegin or %insert(\"pythonbegin\") block"); - Printv(f_shadow_begin, pycode, NIL); - Delete(pycode); + if (shadow) { + String *pycode = indent_pythoncode(code, "", Getfile(n), Getline(n), "%pythonbegin or %insert(\"pythonbegin\") block"); + Printv(f_shadow_begin, pycode, NIL); + Delete(pycode); + } } else { Language::insertDirective(n); }