From dde8a99c297474785555bb2bc0cd8b642c418f1b Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 23 Aug 2007 17:38:17 +0100 Subject: [PATCH] Check that self->obj isn't NULL before probing its typeid in tp_traverse --- pybindgen/cppclass.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pybindgen/cppclass.py b/pybindgen/cppclass.py index 421481d..6ff662d 100644 --- a/pybindgen/cppclass.py +++ b/pybindgen/cppclass.py @@ -624,7 +624,7 @@ static void visit_self = '' else: visit_self = ''' - if (typeid(*self->obj) == typeid(%s)) + if (self->obj && typeid(*self->obj) == typeid(%s)) Py_VISIT(self); ''' % self.helper_class.name