summaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Debugger
diff options
context:
space:
mode:
authororivej <[email protected]>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/tools/cython/Cython/Debugger
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Debugger')
-rw-r--r--contrib/tools/cython/Cython/Debugger/Cygdb.py2
-rw-r--r--contrib/tools/cython/Cython/Debugger/DebugWriter.py18
-rw-r--r--contrib/tools/cython/Cython/Debugger/Tests/TestLibCython.py36
-rw-r--r--contrib/tools/cython/Cython/Debugger/Tests/test_libcython_in_gdb.py16
-rw-r--r--contrib/tools/cython/Cython/Debugger/Tests/test_libpython_in_gdb.py4
-rw-r--r--contrib/tools/cython/Cython/Debugger/libcython.py48
-rw-r--r--contrib/tools/cython/Cython/Debugger/libpython.py14
7 files changed, 69 insertions, 69 deletions
diff --git a/contrib/tools/cython/Cython/Debugger/Cygdb.py b/contrib/tools/cython/Cython/Debugger/Cygdb.py
index 029adb1742b..45f31ce6f77 100644
--- a/contrib/tools/cython/Cython/Debugger/Cygdb.py
+++ b/contrib/tools/cython/Cython/Debugger/Cygdb.py
@@ -126,7 +126,7 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
logging_level = logging.WARN
if options.verbosity == 1:
logging_level = logging.INFO
- if options.verbosity >= 2:
+ if options.verbosity >= 2:
logging_level = logging.DEBUG
logging.basicConfig(level=logging_level)
diff --git a/contrib/tools/cython/Cython/Debugger/DebugWriter.py b/contrib/tools/cython/Cython/Debugger/DebugWriter.py
index a5f30e88507..876a3a2169a 100644
--- a/contrib/tools/cython/Cython/Debugger/DebugWriter.py
+++ b/contrib/tools/cython/Cython/Debugger/DebugWriter.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import
import os
import sys
@@ -15,9 +15,9 @@ except ImportError:
try:
from xml.etree import ElementTree as etree
except ImportError:
- etree = None
+ etree = None
-from ..Compiler import Errors
+from ..Compiler import Errors
class CythonDebugWriter(object):
@@ -32,7 +32,7 @@ class CythonDebugWriter(object):
if etree is None:
raise Errors.NoElementTreeInstalledException()
- self.output_dir = os.path.join(output_dir or os.curdir, 'cython_debug')
+ self.output_dir = os.path.join(output_dir or os.curdir, 'cython_debug')
self.tb = etree.TreeBuilder()
# set by Cython.Compiler.ParseTreeTransforms.DebugTransform
self.module_name = None
@@ -44,10 +44,10 @@ class CythonDebugWriter(object):
def end(self, name):
self.tb.end(name)
- def add_entry(self, name, **attrs):
- self.tb.start(name, attrs)
- self.tb.end(name)
-
+ def add_entry(self, name, **attrs):
+ self.tb.start(name, attrs)
+ self.tb.end(name)
+
def serialize(self):
self.tb.end('Module')
self.tb.end('cython_debug')
@@ -55,7 +55,7 @@ class CythonDebugWriter(object):
try:
os.makedirs(self.output_dir)
- except OSError as e:
+ except OSError as e:
if e.errno != errno.EEXIST:
raise
diff --git a/contrib/tools/cython/Cython/Debugger/Tests/TestLibCython.py b/contrib/tools/cython/Cython/Debugger/Tests/TestLibCython.py
index a23d31f534f..13560646ffc 100644
--- a/contrib/tools/cython/Cython/Debugger/Tests/TestLibCython.py
+++ b/contrib/tools/cython/Cython/Debugger/Tests/TestLibCython.py
@@ -14,7 +14,7 @@ from distutils import ccompiler
import runtests
import Cython.Distutils.extension
-import Cython.Distutils.old_build_ext as build_ext
+import Cython.Distutils.old_build_ext as build_ext
from Cython.Debugger import Cygdb as cygdb
root = os.path.dirname(os.path.abspath(__file__))
@@ -31,38 +31,38 @@ def test_gdb():
if have_gdb is not None:
return have_gdb
- have_gdb = False
+ have_gdb = False
try:
- p = subprocess.Popen(['gdb', '-nx', '--version'], stdout=subprocess.PIPE)
+ p = subprocess.Popen(['gdb', '-nx', '--version'], stdout=subprocess.PIPE)
except OSError:
- # gdb not found
- gdb_version = None
+ # gdb not found
+ gdb_version = None
else:
- stdout, _ = p.communicate()
+ stdout, _ = p.communicate()
# Based on Lib/test/test_gdb.py
- regex = r"GNU gdb [^\d]*(\d+)\.(\d+)"
- gdb_version = re.match(regex, stdout.decode('ascii', 'ignore'))
+ regex = r"GNU gdb [^\d]*(\d+)\.(\d+)"
+ gdb_version = re.match(regex, stdout.decode('ascii', 'ignore'))
- if gdb_version:
- gdb_version_number = list(map(int, gdb_version.groups()))
+ if gdb_version:
+ gdb_version_number = list(map(int, gdb_version.groups()))
if gdb_version_number >= [7, 2]:
- have_gdb = True
- with tempfile.NamedTemporaryFile(mode='w+') as python_version_script:
+ have_gdb = True
+ with tempfile.NamedTemporaryFile(mode='w+') as python_version_script:
python_version_script.write(
'python import sys; print("%s %s" % sys.version_info[:2])')
python_version_script.flush()
p = subprocess.Popen(['gdb', '-batch', '-x', python_version_script.name],
stdout=subprocess.PIPE)
- stdout, _ = p.communicate()
+ stdout, _ = p.communicate()
try:
- internal_python_version = list(map(int, stdout.decode('ascii', 'ignore').split()))
- if internal_python_version < [2, 6]:
- have_gdb = False
+ internal_python_version = list(map(int, stdout.decode('ascii', 'ignore').split()))
+ if internal_python_version < [2, 6]:
+ have_gdb = False
except ValueError:
have_gdb = False
- if not have_gdb:
- warnings.warn('Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6')
+ if not have_gdb:
+ warnings.warn('Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6')
return have_gdb
diff --git a/contrib/tools/cython/Cython/Debugger/Tests/test_libcython_in_gdb.py b/contrib/tools/cython/Cython/Debugger/Tests/test_libcython_in_gdb.py
index e798e7564f6..bd7608d6079 100644
--- a/contrib/tools/cython/Cython/Debugger/Tests/test_libcython_in_gdb.py
+++ b/contrib/tools/cython/Cython/Debugger/Tests/test_libcython_in_gdb.py
@@ -5,8 +5,8 @@ Note: debug information is already imported by the file generated by
Cython.Debugger.Cygdb.make_command_file()
"""
-from __future__ import absolute_import
-
+from __future__ import absolute_import
+
import os
import re
import sys
@@ -23,10 +23,10 @@ import itertools
import gdb
-from .. import libcython
-from .. import libpython
-from . import TestLibCython as test_libcython
-from ...Utils import add_metaclass
+from .. import libcython
+from .. import libpython
+from . import TestLibCython as test_libcython
+from ...Utils import add_metaclass
# for some reason sys.argv is missing in gdb
sys.argv = ['gdb']
@@ -48,12 +48,12 @@ def print_on_call_decorator(func):
class TraceMethodCallMeta(type):
def __init__(self, name, bases, dict):
- for func_name, func in dict.items():
+ for func_name, func in dict.items():
if inspect.isfunction(func):
setattr(self, func_name, print_on_call_decorator(func))
-@add_metaclass(TraceMethodCallMeta)
+@add_metaclass(TraceMethodCallMeta)
class DebugTestCase(unittest.TestCase):
"""
Base class for test cases. On teardown it kills the inferior and unsets
diff --git a/contrib/tools/cython/Cython/Debugger/Tests/test_libpython_in_gdb.py b/contrib/tools/cython/Cython/Debugger/Tests/test_libpython_in_gdb.py
index d5e01187ed8..6f34cee47b3 100644
--- a/contrib/tools/cython/Cython/Debugger/Tests/test_libpython_in_gdb.py
+++ b/contrib/tools/cython/Cython/Debugger/Tests/test_libpython_in_gdb.py
@@ -14,8 +14,8 @@ import gdb
from Cython.Debugger import libcython
from Cython.Debugger import libpython
-from . import test_libcython_in_gdb
-from .test_libcython_in_gdb import _debug, inferior_python_version
+from . import test_libcython_in_gdb
+from .test_libcython_in_gdb import _debug, inferior_python_version
class TestPrettyPrinters(test_libcython_in_gdb.DebugTestCase):
diff --git a/contrib/tools/cython/Cython/Debugger/libcython.py b/contrib/tools/cython/Cython/Debugger/libcython.py
index 238d5788531..23153789b66 100644
--- a/contrib/tools/cython/Cython/Debugger/libcython.py
+++ b/contrib/tools/cython/Cython/Debugger/libcython.py
@@ -4,11 +4,11 @@ GDB extension that adds Cython support.
from __future__ import print_function
-try:
- input = raw_input
-except NameError:
- pass
-
+try:
+ input = raw_input
+except NameError:
+ pass
+
import sys
import textwrap
import traceback
@@ -346,12 +346,12 @@ class CythonBase(object):
except RuntimeError:
func_address = 0
else:
- func_address = gdb_value.address
- if not isinstance(func_address, int):
- # Seriously? Why is the address not an int?
- if not isinstance(func_address, (str, bytes)):
- func_address = str(func_address)
- func_address = int(func_address.split()[0], 0)
+ func_address = gdb_value.address
+ if not isinstance(func_address, int):
+ # Seriously? Why is the address not an int?
+ if not isinstance(func_address, (str, bytes)):
+ func_address = str(func_address)
+ func_address = int(func_address.split()[0], 0)
a = ', '.join('%s=%s' % (name, val) for name, val in func_args)
sys.stdout.write('#%-2d 0x%016x in %s(%s)' % (index, func_address, func_name, a))
@@ -392,7 +392,7 @@ class CythonBase(object):
result = {}
seen = set()
- for k, v in pyobject_dict.items():
+ for k, v in pyobject_dict.items():
result[k.proxyval(seen)] = v
return result
@@ -416,7 +416,7 @@ class CythonBase(object):
# Closed over free variable
if cur_lineno > cython_func.lineno:
if cyvar.type == PythonObject:
- return int(gdb.parse_and_eval(cyvar.cname))
+ return int(gdb.parse_and_eval(cyvar.cname))
return True
return False
@@ -743,7 +743,7 @@ class CyImport(CythonCommand):
for marker in module.find('LineNumberMapping'):
cython_lineno = int(marker.attrib['cython_lineno'])
- c_linenos = list(map(int, marker.attrib['c_linenos'].split()))
+ c_linenos = list(map(int, marker.attrib['c_linenos'].split()))
cython_module.lineno_cy2c[cython_lineno] = min(c_linenos)
for c_lineno in c_linenos:
cython_module.lineno_c2cy[c_lineno] = cython_lineno
@@ -816,7 +816,7 @@ class CyBreak(CythonCommand):
while True:
try:
- result = input(
+ result = input(
"Select a function, press 'a' for all "
"functions or press 'q' or '^D' to quit: ")
except EOFError:
@@ -863,10 +863,10 @@ class CyBreak(CythonCommand):
def complete(self, text, word):
# Filter init-module functions (breakpoints can be set using
# modulename:linenumber).
- names = [n for n, L in self.cy.functions_by_name.items()
- if any(not f.is_initmodule_function for f in L)]
- qnames = [n for n, f in self.cy.functions_by_qualified_name.items()
- if not f.is_initmodule_function]
+ names = [n for n, L in self.cy.functions_by_name.items()
+ if any(not f.is_initmodule_function for f in L)]
+ qnames = [n for n, f in self.cy.functions_by_qualified_name.items()
+ if not f.is_initmodule_function]
if parameters.complete_unqualified:
all_names = itertools.chain(qnames, names)
@@ -1156,7 +1156,7 @@ class CyLocals(CythonCommand):
local_cython_vars = cython_function.locals
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.items(), key=sortkey):
if self.is_initialized(self.get_cython_function(), cyvar.name):
value = gdb.parse_and_eval(cyvar.cname)
if not value.is_optimized_out:
@@ -1189,13 +1189,13 @@ class CyGlobals(CyLocals):
seen = set()
print('Python globals:')
- for k, v in sorted(global_python_dict.items(), key=sortkey):
+ for k, v in sorted(global_python_dict.items(), key=sortkey):
v = v.get_truncated_repr(libpython.MAX_OUTPUT_LEN)
seen.add(k)
print(' %-*s = %s' % (max_name_length, k, v))
print('C globals:')
- for name, cyvar in sorted(module_globals.items(), key=sortkey):
+ for name, cyvar in sorted(module_globals.items(), key=sortkey):
if name not in seen:
try:
value = gdb.parse_and_eval(cyvar.cname)
@@ -1218,8 +1218,8 @@ class EvaluateOrExecuteCodeMixin(object):
"Fill a remotely allocated dict with values from the Cython C stack"
cython_func = self.get_cython_function()
- for name, cyvar in cython_func.locals.items():
- if cyvar.type == PythonObject and self.is_initialized(cython_func, name):
+ for name, cyvar in cython_func.locals.items():
+ if cyvar.type == PythonObject and self.is_initialized(cython_func, name):
try:
val = gdb.parse_and_eval(cyvar.cname)
except RuntimeError:
diff --git a/contrib/tools/cython/Cython/Debugger/libpython.py b/contrib/tools/cython/Cython/Debugger/libpython.py
index 213a60de5ae..fea626dd730 100644
--- a/contrib/tools/cython/Cython/Debugger/libpython.py
+++ b/contrib/tools/cython/Cython/Debugger/libpython.py
@@ -46,10 +46,10 @@ the type names are known to the debugger
The module also extends gdb with some python-specific commands.
'''
-
+
# NOTE: some gdbs are linked with Python 3, so this file should be dual-syntax
# compatible (2.6+ and 3.0+). See #19308.
-
+
from __future__ import print_function
import gdb
import os
@@ -2486,17 +2486,17 @@ class PyCont(ExecutionControlCommandBase):
def _pointervalue(gdbval):
"""
- Return the value of the pointer as a Python int.
+ Return the value of the pointer as a Python int.
gdbval.type must be a pointer type
"""
# don't convert with int() as it will raise a RuntimeError
if gdbval.address is not None:
- return int(gdbval.address)
+ return int(gdbval.address)
else:
# the address attribute is None sometimes, in which case we can
# still convert the pointer to an int
- return int(gdbval)
+ return int(gdbval)
def pointervalue(gdbval):
@@ -2688,7 +2688,7 @@ class FixGdbCommand(gdb.Command):
warnings.filterwarnings('ignore', r'.*', RuntimeWarning,
re.escape(__name__))
try:
- int(gdb.parse_and_eval("(void *) 0")) == 0
+ int(gdb.parse_and_eval("(void *) 0")) == 0
except RuntimeError:
pass
# warnings.resetwarnings()
@@ -2726,7 +2726,7 @@ class PyExec(gdb.Command):
lines = []
while True:
try:
- line = input('>')
+ line = input('>')
except EOFError:
break
else: