From 64083938faa82ae1afc493a8477e21d4c8fc3a35 Mon Sep 17 00:00:00 2001 From: Ken Patel Date: Wed, 5 May 2010 17:39:55 +0000 Subject: [PATCH] bpdb - handle exception caused when placing bp in a __init__ function --- direct/src/showbase/PythonUtil.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index aff3c990fe..30e546138b 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -4409,7 +4409,7 @@ class BpDb: return decorator @staticmethod - def bpGroup(*args, **kArgs): + def bpGroup(*args, **kArgs): #rename bpGroup -> bpPreset def functor(*cArgs, **ckArgs): return @@ -4485,9 +4485,13 @@ class bp: #look for self if grp is None: slf = inspect.stack()[frameCount][0].f_locals.get('self') - if slf: - className = slf.__class__.__name__ - grp = className + try: + if slf: + className = slf.__class__.__name__ + grp = className + except: + #in __init__ 'self' exists but 'if slf' will crash + pass #default to module if grp is None: grp = moduleName