Commit 139bd745 authored by Stefan Behnel's avatar Stefan Behnel

Revert dictionary item iteration in "libcython.py" to use ".iteritems()"...

Revert dictionary item iteration in "libcython.py" to use ".iteritems()" instead of ".items()" since the first is implemented explicitly by "libpython.py".
parent c6807afd
...@@ -392,7 +392,7 @@ class CythonBase(object): ...@@ -392,7 +392,7 @@ class CythonBase(object):
result = {} result = {}
seen = set() seen = set()
for k, v in pyobject_dict.items(): for k, v in pyobject_dict.iteritems():
result[k.proxyval(seen)] = v result[k.proxyval(seen)] = v
return result return result
...@@ -863,9 +863,9 @@ class CyBreak(CythonCommand): ...@@ -863,9 +863,9 @@ class CyBreak(CythonCommand):
def complete(self, text, word): def complete(self, text, word):
# Filter init-module functions (breakpoints can be set using # Filter init-module functions (breakpoints can be set using
# modulename:linenumber). # modulename:linenumber).
names = [n for n, L in self.cy.functions_by_name.items() names = [n for n, L in self.cy.functions_by_name.iteritems()
if any(not f.is_initmodule_function for f in L)] if any(not f.is_initmodule_function for f in L)]
qnames = [n for n, f in self.cy.functions_by_qualified_name.items() qnames = [n for n, f in self.cy.functions_by_qualified_name.iteritems()
if not f.is_initmodule_function] if not f.is_initmodule_function]
if parameters.complete_unqualified: if parameters.complete_unqualified:
...@@ -1156,7 +1156,7 @@ class CyLocals(CythonCommand): ...@@ -1156,7 +1156,7 @@ class CyLocals(CythonCommand):
local_cython_vars = cython_function.locals local_cython_vars = cython_function.locals
max_name_length = len(max(local_cython_vars, key=len)) max_name_length = len(max(local_cython_vars, key=len))
for name, cyvar in sorted(local_cython_vars.items(), key=sortkey): for name, cyvar in sorted(local_cython_vars.iteritems(), key=sortkey):
if self.is_initialized(self.get_cython_function(), cyvar.name): if self.is_initialized(self.get_cython_function(), cyvar.name):
value = gdb.parse_and_eval(cyvar.cname) value = gdb.parse_and_eval(cyvar.cname)
if not value.is_optimized_out: if not value.is_optimized_out:
...@@ -1189,13 +1189,13 @@ class CyGlobals(CyLocals): ...@@ -1189,13 +1189,13 @@ class CyGlobals(CyLocals):
seen = set() seen = set()
print('Python globals:') print('Python globals:')
for k, v in sorted(global_python_dict.items(), key=sortkey): for k, v in sorted(global_python_dict.iteritems(), key=sortkey):
v = v.get_truncated_repr(libpython.MAX_OUTPUT_LEN) v = v.get_truncated_repr(libpython.MAX_OUTPUT_LEN)
seen.add(k) seen.add(k)
print(' %-*s = %s' % (max_name_length, k, v)) print(' %-*s = %s' % (max_name_length, k, v))
print('C globals:') print('C globals:')
for name, cyvar in sorted(module_globals.items(), key=sortkey): for name, cyvar in sorted(module_globals.iteritems(), key=sortkey):
if name not in seen: if name not in seen:
try: try:
value = gdb.parse_and_eval(cyvar.cname) value = gdb.parse_and_eval(cyvar.cname)
...@@ -1218,8 +1218,10 @@ class EvaluateOrExecuteCodeMixin(object): ...@@ -1218,8 +1218,10 @@ class EvaluateOrExecuteCodeMixin(object):
"Fill a remotely allocated dict with values from the Cython C stack" "Fill a remotely allocated dict with values from the Cython C stack"
cython_func = self.get_cython_function() cython_func = self.get_cython_function()
for name, cyvar in cython_func.locals.items(): for name, cyvar in cython_func.locals.iteritems():
if cyvar.type == PythonObject and self.is_initialized(cython_func, name): if (cyvar.type == PythonObject and
self.is_initialized(cython_func, name)):
try: try:
val = gdb.parse_and_eval(cyvar.cname) val = gdb.parse_and_eval(cyvar.cname)
except RuntimeError: except RuntimeError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment