File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -845,7 +845,7 @@ def test_pycfunction(self):
845845 breakpoint = 'time_gmtime' ,
846846 cmds_after_breakpoint = ['py-bt-full' ],
847847 )
848- self .assertIn ('#0 <built-in method gmtime' , gdb_output )
848+ self .assertIn ('#1 <built-in method gmtime' , gdb_output )
849849
850850
851851class PyPrintTests (DebuggerTests ):
Original file line number Diff line number Diff line change @@ -1497,34 +1497,28 @@ def is_other_python_frame(self):
14971497 return 'Garbage-collecting'
14981498
14991499 # Detect invocations of PyCFunction instances:
1500- older = self .older ()
1501- if not older :
1502- return False
1503-
1504- caller = older ._gdbframe .name ()
1500+ frame = self ._gdbframe
1501+ caller = frame .name ()
15051502 if not caller :
15061503 return False
15071504
1508- if caller == 'PyCFunction_Call' :
1505+ if caller in ('_PyCFunction_FastCallDict' ,
1506+ '_PyCFunction_FastCallKeywords' ):
1507+ if caller == '_PyCFunction_FastCallKeywords' :
1508+ arg_name = 'func_obj'
1509+ else :
1510+ arg_name = 'func'
15091511 # Within that frame:
15101512 # "func" is the local containing the PyObject* of the
15111513 # PyCFunctionObject instance
15121514 # "f" is the same value, but cast to (PyCFunctionObject*)
15131515 # "self" is the (PyObject*) of the 'self'
15141516 try :
15151517 # Use the prettyprinter for the func:
1516- func = older ._gdbframe .read_var ('func' )
1517- return str (func )
1518- except RuntimeError :
1519- return 'PyCFunction invocation (unable to read "func")'
1520-
1521- elif caller in ('_PyCFunction_FastCallDict' ,
1522- '_PyCFunction_FastCallKeywords' ):
1523- try :
1524- func = older ._gdbframe .read_var ('func_obj' )
1518+ func = frame .read_var (arg_name )
15251519 return str (func )
15261520 except RuntimeError :
1527- return 'PyCFunction invocation (unable to read "func_obj")'
1521+ return 'PyCFunction invocation (unable to read %s)' % arg_name
15281522
15291523 # This frame isn't worth reporting:
15301524 return False
You can’t perform that action at this time.
0 commit comments