diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_signature.py b/python/helpers/pydev/_pydevd_bundle/pydevd_signature.py index d8476199c233..8203abca50f4 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_signature.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_signature.py @@ -169,17 +169,18 @@ def create_signature_message(signature): def send_signature_call_trace(dbg, frame, filename): if dbg.signature_factory and dbg.signature_factory.is_in_scope(filename): signature = dbg.signature_factory.create_signature(frame) - if dbg.signature_factory.cache is not None: - if not dbg.signature_factory.cache.is_in_cache(signature): - dbg.signature_factory.cache.add(signature) + if signature is not None: + if dbg.signature_factory.cache is not None: + if not dbg.signature_factory.cache.is_in_cache(signature): + dbg.signature_factory.cache.add(signature) + dbg.writer.add_command(create_signature_message(signature)) + return True + else: + # we don't send signature if it is cached + return False + else: dbg.writer.add_command(create_signature_message(signature)) return True - else: - # we don't send signature if it is cached - return False - else: - dbg.writer.add_command(create_signature_message(signature)) - return True return False diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_utils.py b/python/helpers/pydev/_pydevd_bundle/pydevd_utils.py index 9b2ca6733fa2..bb5067a882bf 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_utils.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_utils.py @@ -157,20 +157,21 @@ def get_clsname_for_code(code, frame): func_name = code.co_name if len(code.co_varnames) > 0: first_arg_name = code.co_varnames[0] - first_arg_obj = frame.f_locals[first_arg_name] - if inspect.isclass(first_arg_obj): # class method - first_arg_class = first_arg_obj - else: # instance method - first_arg_class = first_arg_obj.__class__ - if hasattr(first_arg_class, func_name): - method = getattr(first_arg_class, func_name) - func_code = None - if hasattr(method, 'func_code'): # Python2 - func_code = method.func_code - elif hasattr(method, '__code__'): # Python3 - func_code = method.__code__ - if func_code and func_code == code: - clsname = first_arg_class.__name__ + if first_arg_name in frame.f_locals: + first_arg_obj = frame.f_locals[first_arg_name] + if inspect.isclass(first_arg_obj): # class method + first_arg_class = first_arg_obj + else: # instance method + first_arg_class = first_arg_obj.__class__ + if hasattr(first_arg_class, func_name): + method = getattr(first_arg_class, func_name) + func_code = None + if hasattr(method, 'func_code'): # Python2 + func_code = method.func_code + elif hasattr(method, '__code__'): # Python3 + func_code = method.__code__ + if func_code and func_code == code: + clsname = first_arg_class.__name__ return clsname