diff -r 4332a6751b14 -r 27f56dc07b5b DebugClients/Python/DebugClientBase.py --- a/DebugClients/Python/DebugClientBase.py Tue Oct 11 21:55:03 2016 +0200 +++ b/DebugClients/Python/DebugClientBase.py Fri Oct 14 23:02:38 2016 +0200 @@ -344,11 +344,15 @@ filename = excval.filename lineno = excval.lineno charno = excval.offset + if charno is None: + charno = 0 + except (AttributeError, ValueError): message = "" filename = "" lineno = 0 charno = 0 + self.sendSyntaxError(message, filename, lineno, charno) return None @@ -1413,18 +1417,23 @@ DebugVariables.getType(variable) if resolver: variable = resolver.resolve(variable, attribute) + if variable is None: + break + else: break - typeObject, typeName, typeStr, resolver = \ - DebugVariables.getType(variable) - if typeStr.startswith(("PyQt5.", "PyQt4.")): - vlist = self.__formatQtVariable(variable, typeName) - varlist.extend(vlist) - elif resolver: - dict = resolver.getDictionary(variable) - vlist = self.__formatVariablesList( - list(dict.keys()), dict, scope, filter) - varlist.extend(vlist) + + if variable is not None: + typeObject, typeName, typeStr, resolver = \ + DebugVariables.getType(variable) + if typeStr.startswith(("PyQt5.", "PyQt4.")): + vlist = self.__formatQtVariable(variable, typeName) + varlist.extend(vlist) + elif resolver: + dict = resolver.getDictionary(variable) + vlist = self.__formatVariablesList( + list(dict.keys()), dict, scope, filter) + varlist.extend(vlist) self.sendJsonCommand("ResponseVariable", { "scope": scope, @@ -1649,12 +1658,16 @@ else: value = dict_[key] valtypestr = str(type(value))[1:-1] - _, valtype = valtypestr.split(' ', 1) valtype = valtype[1:-1] + valtypename = type(value).__name__ if valtype not in ConfigVarTypeStrings: - if ConfigVarTypeStrings.index('instance') in filter: - continue + if valtype in ["numpy.ndarray", "array.array"]: + if ConfigVarTypeStrings.index('list') in filter: + continue + elif valtypename == "MultiValueDict": + if ConfigVarTypeStrings.index('dict') in filter: + continue elif valtype == "sip.methoddescriptor": if ConfigVarTypeStrings.index( 'method') in filter: @@ -1662,7 +1675,12 @@ elif valtype == "sip.enumtype": if ConfigVarTypeStrings.index('class') in filter: continue - valtype = valtypestr + elif ConfigVarTypeStrings.index('instance') in filter: + continue + + if valtypename not in ["ndarray", "MultiValueDict", + "array"]: + valtype = valtypestr else: try: if ConfigVarTypeStrings.index(valtype) in filter: @@ -1684,17 +1702,22 @@ continue try: - if valtype not in ['list', 'tuple', 'dict', 'set', - 'frozenset']: + if valtype in ['list', 'tuple', 'dict', 'set', + 'frozenset', 'array.array']: + if valtype == 'dict': + rvalue = "{0:d}".format(len(value.keys())) + else: + rvalue = "{0:d}".format(len(value)) + elif valtype == "numpy.ndarray": + rvalue = "{0:d}".format(value.size) + elif valtypename == "MultiValueDict": + rvalue = "{0:d}".format(len(value.keys())) + valtype = "django.MultiValueDict" # shortened type + else: rvalue = repr(value) if valtype.startswith('class') and \ rvalue[0] in ['{', '(', '[']: rvalue = "" - else: - if valtype == 'dict': - rvalue = "{0:d}".format(len(value.keys())) - else: - rvalue = "{0:d}".format(len(value)) except Exception: rvalue = ''