Hi, when trying to debug cython3 modules from gdb build also with python3, you get a error in gdb plugin code "Python Exception <class 'TypeError'> must be str, not bytes:". This is because in Cython.Debugger.libcython during "cy import" or "cy break" a bytes object is passed to gdb.string_to_argv, but it expects a normal str. I attached a simple fix that worked for me, but I don't know enough about the gdb's plugin system whether it will hold in all cases.
The gdb version I ran into this with is 7.10.1.
>From 98d0f5949001951aaeae3b11bb3300f41ccc90ff Mon Sep 17 00:00:00 2001 From: Marvin Poul <pon...@creshal.de> Date: Tue, 23 Feb 2016 16:35:04 +0100 Subject: [PATCH] don't convert string_to_argv argument to bytes neither shlex nor gdb expect this --- Cython/Debugger/libcython.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Cython/Debugger/libcython.py b/Cython/Debugger/libcython.py index 13a582f..b610d9f 100644 --- a/Cython/Debugger/libcython.py +++ b/Cython/Debugger/libcython.py @@ -57,7 +57,6 @@ CObject = 'CObject' PythonObject = 'PythonObject' _data_types = dict(CObject=CObject, PythonObject=PythonObject) -_filesystemencoding = sys.getfilesystemencoding() or 'UTF-8' # decorators @@ -689,7 +688,6 @@ class CyImport(CythonCommand): completer_class = gdb.COMPLETE_FILENAME def invoke(self, args, from_tty): - args = args.encode(_filesystemencoding) for arg in string_to_argv(args): try: f = open(arg) @@ -834,7 +832,7 @@ class CyBreak(CythonCommand): gdb.execute('break %s' % func.pf_cname) def invoke(self, function_names, from_tty): - argv = string_to_argv(function_names.encode('UTF-8')) + argv = string_to_argv(function_names) if function_names.startswith('-p'): argv = argv[1:] python_breakpoints = True -- 2.7.1
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel