From 0287a16b3c0b4159a45183da4db5459e2e14affe Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 22 Sep 2015 19:28:13 -0700 Subject: [PATCH] Fix segfault on ^C. Resolves #87. --- pysass.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pysass.cpp b/pysass.cpp index 673a4acd..dee6c1cd 100644 --- a/pysass.cpp +++ b/pysass.cpp @@ -278,6 +278,7 @@ static union Sass_Value* _exception_to_sass_error() { PyObject* evalue = NULL; PyObject* etb = NULL; PyErr_Fetch(&etype, &evalue, &etb); + PyErr_NormalizeException(&etype, &evalue, &etb); { PyObject* traceback_mod = PyImport_ImportModule("traceback"); PyObject* traceback_parts = PyObject_CallMethod( @@ -296,6 +297,9 @@ static union Sass_Value* _exception_to_sass_error() { Py_DECREF(result); Py_DECREF(bytes); } + Py_DECREF(etype); + Py_DECREF(evalue); + Py_DECREF(etb); return retv; }