Fix the variable filter for Python 3.

Wed, 26 Oct 2016 21:51:39 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 26 Oct 2016 21:51:39 +0200
changeset 5278
efd21f457e06
parent 5277
ed66a44dcd84
child 5279
7aa4ead48395

Fix the variable filter for Python 3.

DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
DebugClients/Python/DebugConfig.py file | annotate | diff | comparison | revisions
Debugger/Config.py file | annotate | diff | comparison | revisions
diff -r ed66a44dcd84 -r efd21f457e06 DebugClients/Python/DebugClientBase.py
--- a/DebugClients/Python/DebugClientBase.py	Wed Oct 26 19:29:01 2016 +0200
+++ b/DebugClients/Python/DebugClientBase.py	Wed Oct 26 21:51:39 2016 +0200
@@ -1690,11 +1690,12 @@
                         valtype = valtypestr
                 else:
                     try:
-                        if ConfigVarTypeStrings.index(valtype) in filter:
-                            continue
                         # Strip 'instance' to be equal with Python 3
                         if valtype == "instancemethod":
                             valtype = "method"
+                        
+                        if ConfigVarTypeStrings.index(valtype) in filter:
+                            continue
                     except ValueError:
                         if valtype == "classobj":
                             if ConfigVarTypeStrings.index(
diff -r ed66a44dcd84 -r efd21f457e06 DebugClients/Python/DebugConfig.py
--- a/DebugClients/Python/DebugConfig.py	Wed Oct 26 19:29:01 2016 +0200
+++ b/DebugClients/Python/DebugConfig.py	Wed Oct 26 21:51:39 2016 +0200
@@ -15,10 +15,13 @@
     'bool', 'int', 'long', 'float', 'complex',
     'str', 'unicode', 'tuple', 'list',
     'dict', 'dict-proxy', 'set', 'file', 'xrange',
-    'slice', 'buffer', 'class', 'instance', 'instancemethod',
+    'slice', 'buffer', 'class', 'instance',
     'method', 'property', 'generator',
     'function', 'builtin_function_or_method', 'code', 'module',
-    'ellipsis', 'traceback', 'frame', 'other', 'frozenset'
+    'ellipsis', 'traceback', 'frame', 'other', 'frozenset',
+    # Special case for Python 2: don't add 'instancemethod' to
+    # ConfigVarTypeFilters and leave it always at last position
+    'instancemethod'
 ]
 
 #
diff -r ed66a44dcd84 -r efd21f457e06 Debugger/Config.py
--- a/Debugger/Config.py	Wed Oct 26 19:29:01 2016 +0200
+++ b/Debugger/Config.py	Wed Oct 26 21:51:39 2016 +0200
@@ -12,6 +12,8 @@
 from PyQt5.QtCore import QT_TRANSLATE_NOOP
 
 # Variables type definition
+# Special case for Python 2: don't add 'instancemethod'. It's renamed to
+# 'method' in DebugClientBase.py to be identical to Python 3
 ConfigVarTypeDispStrings = {
     '__': QT_TRANSLATE_NOOP('Variable Types', 'Hidden Attributes'),
     'NoneType': QT_TRANSLATE_NOOP('Variable Types', 'None'),

eric ide

mercurial