Skip to content

Commit

Permalink
Issue #112: Prepare Stackless 3.5, fix test_pdb.test_pdb_issue_20766
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Anselm Kruis committed Apr 11, 2017
1 parent a14065f commit ec4105e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,10 @@ def test_pdb_next_command_subiterator():
"""

def test_pdb_issue_20766():
# This test depends on undefined behaviour of C-Python: the value
# of frame.f_lineno is only valid, if frame.f_trace is not None.
# Stackless Python behaves exactly like C-Python, if soft-switching
# is disabled.
"""Test for reference leaks when the SIGINT handler is set.
>>> def test_function():
Expand All @@ -924,7 +928,16 @@ def test_pdb_issue_20766():
>>> with PdbTestInput(['continue',
... 'continue']):
... test_function()
... try:
... import stackless
... softswitch_state = stackless.enable_softswitch(False)
... except ImportError:
... test_function()
... else:
... try:
... test_function()
... finally:
... softswitch_state = stackless.enable_softswitch(softswitch_state)
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
(Pdb) continue
Expand Down

0 comments on commit ec4105e

Please sign in to comment.