changeset: 95220:b0b4c4d365b1 user: Victor Stinner date: Fri Mar 27 15:42:37 2015 +0100 files: Lib/test/test_gdb.py description: Issue #22117: Fix test_gdb for the new time.sleep() Use time.gmtime() instead of time.sleep(), because time.sleep() is no more declared with METH_VARARGS but with METH_O. time.gmtime() is still declared with METH_VARARGS and so it is called with PyCFunction_Call() which is the target of the test_gdb unit test. diff -r 77181e30d2c3 -r b0b4c4d365b1 Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py Fri Mar 27 15:36:15 2015 +0100 +++ b/Lib/test/test_gdb.py Fri Mar 27 15:42:37 2015 +0100 @@ -802,25 +802,27 @@ "Python was compiled without thread support") def test_pycfunction(self): 'Verify that "py-bt" displays invocations of PyCFunction instances' - cmd = ('from time import sleep\n' + # Tested function must not be defined with METH_NOARGS or METH_O, + # otherwise call_function() doesn't call PyCFunction_Call() + cmd = ('from time import gmtime\n' 'def foo():\n' - ' sleep(1)\n' + ' gmtime(1)\n' 'def bar():\n' ' foo()\n' 'bar()\n') # Verify with "py-bt": gdb_output = self.get_stack_trace(cmd, - breakpoint='time_sleep', + breakpoint='time_gmtime', cmds_after_breakpoint=['bt', 'py-bt'], ) - self.assertIn('