Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit ec4105e

Browse files
author
Anselm Kruis
committed
Issue #112: Prepare Stackless 3.5, fix test_pdb.test_pdb_issue_20766
Fix the recently added test test_pdb.test_pdb_issue_20766. This test depends on undefined behaviour of C-Python (invalid value of frame.f_lineno if frame.f_trace is None). Stackless-Python behaves differently, if soft-switching is enabled. This change disables soft-switching for this test. https://bitbucket.org/stackless-dev/stackless/issues/112
1 parent a14065f commit ec4105e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Lib/test/test_pdb.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,10 @@ def test_pdb_next_command_subiterator():
912912
"""
913913

914914
def test_pdb_issue_20766():
915+
# This test depends on undefined behaviour of C-Python: the value
916+
# of frame.f_lineno is only valid, if frame.f_trace is not None.
917+
# Stackless Python behaves exactly like C-Python, if soft-switching
918+
# is disabled.
915919
"""Test for reference leaks when the SIGINT handler is set.
916920
917921
>>> def test_function():
@@ -924,7 +928,16 @@ def test_pdb_issue_20766():
924928
925929
>>> with PdbTestInput(['continue',
926930
... 'continue']):
927-
... test_function()
931+
... try:
932+
... import stackless
933+
... softswitch_state = stackless.enable_softswitch(False)
934+
... except ImportError:
935+
... test_function()
936+
... else:
937+
... try:
938+
... test_function()
939+
... finally:
940+
... softswitch_state = stackless.enable_softswitch(softswitch_state)
928941
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
929942
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
930943
(Pdb) continue

0 commit comments

Comments
 (0)