Is this change in debug ranges between 3.11b3 and 3.11b4 intentional/expected?

Hi all! I’m getting back to doing some work on nose2 as there’s a flurry of new contributions today. A few of them center around the testsuite failing on 3.11.0b4 because it expects output from code_debug_ranges which is no longer present in one case.

It’s not a big deal – the fix is already merged – but I’m wondering if the change is intentional or if it could change again in the future.

I tried reading the differences between 3.11.0b3 and 3.11.0b4 but I didn’t bisect or anything sophisticated.

I have a minimal reproduction of the change below.

# foo.py
import unittest
class TestX(unittest.TestCase):
    def test_fail(self):
        self.assertTrue(False)
unittest.main()

Output from python3.11.0b4 (no debug range shown):

F
======================================================================
FAIL: test_fail (__main__.TestX.test_fail)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sirosen/dev/gsearch/foo.py", line 5, in test_fail
    self.assertTrue(False)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)

vs from python3.11.0b3 (debug range under the whole assert):

F
======================================================================
FAIL: test_fail (__main__.TestX.test_fail)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sirosen/dev/gsearch/foo.py", line 5, in test_fail
    self.assertTrue(False)
    ^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)

To be clear, I think not showing the debug range is better behavior! It doesn’t make much sense in this case. But it was a surprise and I’d like to know if I should expect that it might change again.

I believe it’s intentional. See 3.11 backtrace visual indicators are too verbose · Issue #93883 · python/cpython · GitHub.

1 Like

Thanks so much for the reply! That looks like exactly the change.

I didn’t find it because I was looking hard for “debug” and “ranges”. I didn’t try “traceback” or “backtrace”.