summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gdb.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-27 14:42:37 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-27 14:42:37 (GMT)
commit79644f9c83b3cd992c16c6e1bd6c7a5fd49f24c0 (patch)
tree1e3f7a06c6fc6cc9c6512e8f9acd44e8644e2b47 /Lib/test/test_gdb.py
parentba508d5dd2492aa2566385fd59f5b4f1bfe15a90 (diff)
downloadcpython-79644f9c83b3cd992c16c6e1bd6c7a5fd49f24c0.zip
cpython-79644f9c83b3cd992c16c6e1bd6c7a5fd49f24c0.tar.gz
cpython-79644f9c83b3cd992c16c6e1bd6c7a5fd49f24c0.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_gdb.py')
-rw-r--r--Lib/test/test_gdb.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index c57875c..0322677 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -802,25 +802,27 @@ id(42)
"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('<built-in method sleep', gdb_output)
+ self.assertIn('<built-in method gmtime', gdb_output)
# Verify with "py-bt-full":
gdb_output = self.get_stack_trace(cmd,
- breakpoint='time_sleep',
+ breakpoint='time_gmtime',
cmds_after_breakpoint=['py-bt-full'],
)
- self.assertIn('#0 <built-in method sleep', gdb_output)
+ self.assertIn('#0 <built-in method gmtime', gdb_output)
class PyPrintTests(DebuggerTests):