From 5c73bf663e58b45e0688baafe4c0cbfe804d9738 Mon Sep 17 00:00:00 2001 From: Elizaveta Shashkova Date: Thu, 26 Nov 2015 19:57:48 +0300 Subject: [PATCH] Fix collecting runtime type information (PY-17722) Because of incorrect function name, type information was collected for library functions, but not for project functions --- python/helpers/pydev/pydevd.py | 2 +- python/helpers/pydev/pydevd_signature.py | 5 +++-- python/helpers/pydev/pydevd_utils.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/helpers/pydev/pydevd.py b/python/helpers/pydev/pydevd.py index d727cb1397aa..032e117597de 100644 --- a/python/helpers/pydev/pydevd.py +++ b/python/helpers/pydev/pydevd.py @@ -393,7 +393,7 @@ class PyDB: return self.plugin def not_in_scope(self, filename): - return pydevd_utils.is_in_project_roots(filename) + return pydevd_utils.not_in_project_roots(filename) def first_appearance_in_scope(self, trace): if trace is None or self.not_in_scope(trace.tb_frame.f_code.co_filename): diff --git a/python/helpers/pydev/pydevd_signature.py b/python/helpers/pydev/pydevd_signature.py index a63ca8e032f7..653837912777 100644 --- a/python/helpers/pydev/pydevd_signature.py +++ b/python/helpers/pydev/pydevd_signature.py @@ -32,9 +32,10 @@ class Signature(object): class SignatureFactory(object): def __init__(self): self._caller_cache = {} + self._ignore_module_name = ('__main__', '__builtin__', 'builtins') def is_in_scope(self, filename): - return pydevd_utils.is_in_project_roots(filename) + return not pydevd_utils.not_in_project_roots(filename) def create_signature(self, frame): try: @@ -50,7 +51,7 @@ class SignatureFactory(object): tp = locals[name].__class__ class_name = tp.__name__ - if hasattr(tp, '__module__') and tp.__module__ and tp.__module__ != '__main__': + if hasattr(tp, '__module__') and tp.__module__ and tp.__module__ not in self._ignore_module_name: class_name = "%s.%s"%(tp.__module__, class_name) res.add_arg(name, class_name) diff --git a/python/helpers/pydev/pydevd_utils.py b/python/helpers/pydev/pydevd_utils.py index 34fc24cf37b0..eaabb5c46211 100644 --- a/python/helpers/pydev/pydevd_utils.py +++ b/python/helpers/pydev/pydevd_utils.py @@ -128,7 +128,7 @@ def _get_project_roots(project_roots_cache=[]): return project_roots_cache[-1] # returns the project roots with case normalized -def is_in_project_roots(filename, filename_to_not_in_scope_cache={}): +def not_in_project_roots(filename, filename_to_not_in_scope_cache={}): # Note: the filename_to_not_in_scope_cache is the same instance among the many calls to the method try: return filename_to_not_in_scope_cache[filename]