Source: python-stack-data Version: 0.5.0-1 Severity: serious Tags: sid bookworm User: debian...@lists.debian.org Usertags: needs-update User: debian-pyt...@lists.debian.org Usertags: python3.11 Control: affects -1 src:python3-defaults
Dear maintainer(s),We are in the transition of adding python3.11 as a supported Python version [0]. With a recent upload of python3-defaults the autopkgtest of python-stack-data fails in testing when that autopkgtest is run with the binary packages of python3-defaults from unstable. It passes when run with only packages from testing. In tabular form:
pass fail python3-defaults from testing 3.10.6-3 python-stack-data from testing 0.5.0-1 all others from testing from testing I copied some of the output at the bottom of this report.Currently this regression is blocking the migration of python3-defaults to testing [1]. https://docs.python.org/3/whatsnew/3.11.html lists what's new in Python3.11, it may help to identify what needs to be updated.
More information about this bug and the reason for filing it can be found on https://wiki.debian.org/ContinuousIntegration/RegressionEmailInformation Paul [0] https://bugs.debian.org/1021984 [1] https://qa.debian.org/excuses.php?package=python3-defaults https://ci.debian.net/data/autopkgtest/testing/amd64/p/python-stack-data/28750731/log.gz=================================== FAILURES =================================== ________________________________ test_variables ________________________________
def test_variables(): options = Options(before=1, after=0) assert repr(options) == ('Options(after=0, before=1, ' + 'blank_lines=<BlankLines.HIDDEN: 1>,' + ' include_signature=False, ' +'max_lines_per_piece=6, pygments_formatter=None)')
def foo(arg, _arg2: str = None, *_args, **_kwargs): y = 123986 str(y) x = {982347298304} str(x) return ( FrameInfo(inspect.currentframe(), options), arg, arg, )[0] frame_info = foo('this is arg') assert sum(line.is_current for line in frame_info.lines) == 1 body = frame_info.scope.body tup = body[-1].value.value.elts call = tup[0]
assert frame_info.executing.node == call
E AssertionError: assert None == <ast.Call object at 0x7f3677f49fc0>E + where None = <executing.executing.Executing object at 0x7f3677c694d0>.node E + where <executing.executing.Executing object at 0x7f3677c694d0> = FrameInfo(<frame at 0x7f3677f96a40, file '/tmp/autopkgtest-lxc.0v1rnt08/downtmp/autopkgtest_tmp/tests/test_core.py', line 219, code foo>).executing
tests/test_core.py:233: AssertionError_________________________________ test_example _________________________________
def test_example(): from .samples.example import bar result = bar() print(result)
assert result == """\
bar at line 27 -------------- 25 | def bar(): 26 | <var>names</var> = {}27 > <exec>exec("result = foo()", globals(), <var>names</var>)</exec>
28 | return <var>names</var>["result"] names = {} <module> at line 1 ------------------ foo at line 20 -------------- 6 | def foo(): (...) 8 | <var>lst</var> = [1] 10 | <var>lst</var>.insert(0, <var>x</var>) 11 | <var>lst</var>.append( 12 | <var>[</var> 13 | <var> 1,</var> (...) 18 | <var> 6</var> 19 | <var> ][0]</var>) 20 > result = <exec>print_stack(</exec> 21 | <exec>)</exec> 22 | return result [ 1, 2, 3, 4, 5, 6 ][0] = 1 lst = [1, 1, 1] x = 1 """E assert 'bar at line ... \nx = 1 \n\n' == 'bar at line ... \nx = 1 \n\n'
E Skipping 82 identical leading characters in diff, use -v to showE - 27 > <exec>exec("result = foo()", globals(), <var>names</var>)</exec> E ? ------ -------
E + 27 > exec("result = foo()", globals(), <var>names</var>) E 28 | return <var>names</var>["result"] E names = {} E ...E E ...Full output truncated (34 lines hidden), use '-vv' to show
tests/test_core.py:578: AssertionError----------------------------- Captured stdout call -----------------------------
bar at line 27 -------------- 25 | def bar(): 26 | <var>names</var> = {} 27 > exec("result = foo()", globals(), <var>names</var>) 28 | return <var>names</var>["result"] names = {} <module> at line 1 ------------------ foo at line 20 -------------- 6 | def foo(): (...) 8 | <var>lst</var> = [1] 10 | <var>lst</var>.insert(0, <var>x</var>) 11 | <var>lst</var>.append( 12 | <var>[</var> 13 | <var> 1,</var> (...) 18 | <var> 6</var> 19 | <var> ][0]</var>) 20 > result = print_stack( 21 | ) 22 | return result [ 1, 2, 3, 4, 5, 6 ][0] = 1 lst = [1, 1, 1] x = 1____________________________ test_pygments_example _____________________________
@pytest.mark.skipif(pygments_version < (2, 12), reason="Different output in older Pygments")
def test_pygments_example(): from .samples.pygments_example import bar result = bar() print(result)
assert result == """\
Terminal256Formatter native: 13 | \x1bdef\x1b\x1b \x1b\x1bbar\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b 14 | \x1b \x1b\x1bx\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1b1\x1b 15 | \x1b \x1b\x1bstr\x1b\x1b(\x1b\x1bx\x1b\x1b)\x1b 17 | \x1b \x1b\x1b@deco\x1b18 | \x1b \x1b\x1bdef\x1b\x1b \x1b\x1bfoo\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b
19 | \x1b \x1b\x1bpass\x1b -----25 | \x1bdef\x1b\x1b \x1b\x1bdeco\x1b\x1b(\x1b\x1bf\x1b\x1b)\x1b\x1b:\x1b 26 | \x1b \x1b\x1bf\x1b\x1b.\x1b\x1bresult\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1bprint_stack\x1b\x1b(\x1b\x1b)\x1b
27 | \x1b \x1b\x1breturn\x1b\x1b \x1b\x1bf\x1b ----- ====================Terminal256Formatter <class \'stack_data.core.style_with_executing_node.<locals>.NewStyle\'>:
13 | \x1bdef\x1b\x1b \x1b\x1bbar\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b 14 | \x1b \x1b\x1bx\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1b1\x1b 15 | \x1b \x1b\x1bstr\x1b\x1b(\x1b\x1bx\x1b\x1b)\x1b 17 | \x1b \x1b\x1b@deco\x1b18 | \x1b \x1b\x1bdef\x1b\x1b \x1b\x1bfoo\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b
19 | \x1b \x1b\x1bpass\x1b -----25 | \x1bdef\x1b\x1b \x1b\x1bdeco\x1b\x1b(\x1b\x1bf\x1b\x1b)\x1b\x1b:\x1b 26 | \x1b \x1b\x1bf\x1b\x1b.\x1b\x1bresult\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1bprint_stack\x1b\x1b(\x1b\x1b)\x1b
27 | \x1b \x1b\x1breturn\x1b\x1b \x1b\x1bf\x1b ----- ==================== TerminalFormatter native: 13 | \x1bdef\x1b \x1bbar\x1b(): 14 | x = \x1b1\x1b 15 | \x1bstr\x1b(x) 17 | \x1b@deco\x1b 18 | \x1bdef\x1b \x1bfoo\x1b(): 19 | \x1bpass\x1b ----- 25 | \x1bdef\x1b \x1bdeco\x1b(f): 26 | f.result = print_stack() 27 | \x1breturn\x1b f ----- ====================TerminalFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewStyle\'>:
13 | \x1bdef\x1b \x1bbar\x1b(): 14 | x = \x1b1\x1b 15 | \x1bstr\x1b(x) 17 | \x1b@deco\x1b 18 | \x1bdef\x1b \x1bfoo\x1b(): 19 | \x1bpass\x1b ----- 25 | \x1bdef\x1b \x1bdeco\x1b(f): 26 | f.result = print_stack() 27 | \x1breturn\x1b f ----- ==================== TerminalTrueColorFormatter native: 13 | \x1bdef\x1b\x1b \x1b\x1bbar\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b 14 | \x1b \x1b\x1bx\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1b1\x1b 15 | \x1b \x1b\x1bstr\x1b\x1b(\x1b\x1bx\x1b\x1b)\x1b 17 | \x1b \x1b\x1b@deco\x1b18 | \x1b \x1b\x1bdef\x1b\x1b \x1b\x1bfoo\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b
19 | \x1b \x1b\x1bpass\x1b -----25 | \x1bdef\x1b\x1b \x1b\x1bdeco\x1b\x1b(\x1b\x1bf\x1b\x1b)\x1b\x1b:\x1b 26 | \x1b \x1b\x1bf\x1b\x1b.\x1b\x1bresult\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1bprint_stack\x1b\x1b(\x1b\x1b)\x1b
27 | \x1b \x1b\x1breturn\x1b\x1b \x1b\x1bf\x1b ----- ====================TerminalTrueColorFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewStyle\'>:
13 | \x1bdef\x1b\x1b \x1b\x1bbar\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b 14 | \x1b \x1b\x1bx\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1b1\x1b 15 | \x1b \x1b\x1bstr\x1b\x1b(\x1b\x1bx\x1b\x1b)\x1b 17 | \x1b \x1b\x1b@deco\x1b18 | \x1b \x1b\x1bdef\x1b\x1b \x1b\x1bfoo\x1b\x1b(\x1b\x1b)\x1b\x1b:\x1b
19 | \x1b \x1b\x1bpass\x1b -----25 | \x1bdef\x1b\x1b \x1b\x1bdeco\x1b\x1b(\x1b\x1bf\x1b\x1b)\x1b\x1b:\x1b 26 | \x1b \x1b\x1bf\x1b\x1b.\x1b\x1bresult\x1b\x1b \x1b\x1b=\x1b\x1b \x1b\x1bprint_stack\x1b\x1b(\x1b\x1b)\x1b
27 | \x1b \x1b\x1breturn\x1b\x1b \x1b\x1bf\x1b ----- ==================== HtmlFormatter native:13 | <span class="k">def</span> <span class="nf">bar</span><span class="p">():</span> 14 | <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> 15 | <span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
17 | <span class="nd">@deco</span>18 | <span class="k">def</span> <span class="nf">foo</span><span class="p">():</span>
19 | <span class="k">pass</span> -----25 | <span class="k">def</span> <span class="nf">deco</span><span class="p">(</span><span class="n">f</span><span class="p">):</span> 26 | <span class="n">f</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n">print_stack</span><span class="p">()</span>
27 | <span class="k">return</span> <span class="n">f</span> ----- ====================HtmlFormatter <class \'stack_data.core.style_with_executing_node.<locals>.NewStyle\'>: 13 | <span class="k">def</span> <span class="nf">bar</span><span class="p">():</span> 14 | <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> 15 | <span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> 17 | <span class=" -ExecutingNode"> </span><span class="nd nd-ExecutingNode">@deco</span><span class=" -ExecutingNode"></span> 18 | <span class=" -ExecutingNode"> </span><span class="k k-ExecutingNode">def</span><span class=" -ExecutingNode"> </span><span class="nf nf-ExecutingNode">foo</span><span class="p p-ExecutingNode">():</span><span class=" -ExecutingNode"></span> 19 | <span class=" -ExecutingNode"> </span><span class="k k-ExecutingNode">pass</span><span class=" -ExecutingNode"></span>
-----25 | <span class="k">def</span> <span class="nf">deco</span><span class="p">(</span><span class="n">f</span><span class="p">):</span> 26 | <span class="n">f</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n n-ExecutingNode">print_stack</span><span class="p p-ExecutingNode">()</span>
27 | <span class="k">return</span> <span class="n">f</span> ----- ==================== """E AssertionError: assert 'Terminal256F...=========\n\n' == 'Terminal256F...=========\n\n'
E Skipping 1484 identical leading characters in diff, use -v to show E - @deco E ? -------- --- -------- --- E + @deco E - 18 | def foo():E ? -------- --- -------- --- -------- --- -------- ... E E ...Full output truncated (126 lines hidden), use '-vv' to show
tests/test_core.py:624: AssertionError----------------------------- Captured stdout call -----------------------------
Terminal256Formatter native: 13 | def bar(): 14 | x = 1 15 | str(x) 17 | @deco 18 | def foo(): 19 | pass ----- 25 | def deco(f): 26 | f.result = print_stack() 27 | return f ----- ====================Terminal256Formatter <class 'stack_data.core.style_with_executing_node.<locals>.NewStyle'>:
13 | def bar(): 14 | x = 1 15 | str(x) 17 | @deco 18 | def foo(): 19 | pass ----- 25 | def deco(f): 26 | f.result = print_stack() 27 | return f ----- ==================== TerminalFormatter native: 13 | def bar(): 14 | x = 1 15 | str(x) 17 | @deco 18 | def foo(): 19 | pass ----- 25 | def deco(f): 26 | f.result = print_stack() 27 | return f ----- ====================TerminalFormatter <class 'stack_data.core.style_with_executing_node.<locals>.NewStyle'>:
13 | def bar(): 14 | x = 1 15 | str(x) 17 | @deco 18 | def foo(): 19 | pass ----- 25 | def deco(f): 26 | f.result = print_stack() 27 | return f ----- ==================== TerminalTrueColorFormatter native: 13 | def bar(): 14 | x = 1 15 | str(x) 17 | @deco 18 | def foo(): 19 | pass ----- 25 | def deco(f): 26 | f.result = print_stack() 27 | return f ----- ====================TerminalTrueColorFormatter <class 'stack_data.core.style_with_executing_node.<locals>.NewStyle'>:
13 | def bar(): 14 | x = 1 15 | str(x) 17 | @deco 18 | def foo(): 19 | pass ----- 25 | def deco(f): 26 | f.result = print_stack() 27 | return f ----- ==================== HtmlFormatter native:13 | <span class="k">def</span> <span class="nf">bar</span><span class="p">():</span> 14 | <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> 15 | <span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
17 | <span class="nd">@deco</span>18 | <span class="k">def</span> <span class="nf">foo</span><span class="p">():</span>
19 | <span class="k">pass</span> -----25 | <span class="k">def</span> <span class="nf">deco</span><span class="p">(</span><span class="n">f</span><span class="p">):</span> 26 | <span class="n">f</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n">print_stack</span><span class="p">()</span>
27 | <span class="k">return</span> <span class="n">f</span> ----- ====================HtmlFormatter <class 'stack_data.core.style_with_executing_node.<locals>.NewStyle'>:
13 | <span class="k">def</span> <span class="nf">bar</span><span class="p">():</span> 14 | <span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> 15 | <span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
17 | <span class="nd">@deco</span>18 | <span class="k">def</span> <span class="nf">foo</span><span class="p">():</span>
19 | <span class="k">pass</span> -----25 | <span class="k">def</span> <span class="nf">deco</span><span class="p">(</span><span class="n">f</span><span class="p">):</span> 26 | <span class="n">f</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n">print_stack</span><span class="p">()</span>
27 | <span class="k">return</span> <span class="n">f</span> ----- ====================_________________________________ test_example _________________________________
capsys = <_pytest.capture.CaptureFixture object at 0x7f3676e79750> def test_example(capsys):from .samples.formatter_example import bar, print_stack1, format_stack1, format_frame, f_string, blank_lines
@contextmanager def check_example(name): yield stderr = capsys.readouterr().err compare_to_file(stderr, name) > with check_example("variables"):tests/test_formatter.py:40: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.11/contextlib.py:144: in __exit__
next(self.gen) tests/test_formatter.py:38: in check_example compare_to_file(stderr, name)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ text = 'Traceback (most recent call last):\n File "formatter_example.py", line 21, in foo\n 9 | x = 1\n 10 | lst =... + []\n + [] = [1]\nlst = [1]\nn = 0\nn - 1 = -1\nn > 0 = False\nstr(lst) = \'[1]\'\nx = 1\nTypeError\n'
name = 'variables' def compare_to_file(text, name): filename = os.path.join( os.path.dirname(__file__), 'golden_files', name + '.txt', ) if os.environ.get('FIX_STACK_DATA_TESTS'): # string_to_file(text, filename) with open(filename, "w") as f: f.write(string) else: # expected_output = file_to_string(filename) with open(filename) as f: expected_output = f.read()
assert text == expected_output
E AssertionError tests/utils.py:20: AssertionError_________________________________ test_example _________________________________
n = 0 def foo(n=5): if n > 0: return foo(n - 1) x = 1 lst = ( [ x, ] + [] + [] + [] + [] + [] ) try:
return int(str(lst))
E ValueError: invalid literal for int() with base 10: '[1]' tests/samples/formatter_example.py:21: ValueError During handling of the above exception, another exception occurred: n = 0 def foo(n=5): if n > 0: return foo(n - 1) x = 1 lst = ( [ x, ] + [] + [] + [] + [] + [] ) try: return int(str(lst)) except: try:
return 1 / 0
E ZeroDivisionError: division by zero tests/samples/formatter_example.py:24: ZeroDivisionError The above exception was the direct cause of the following exception: def test_example():from .samples.formatter_example import bar, format_frame, format_stack1
result = dict( format_frame=(format_frame(MyFormatter())), format_stack=format_stack1(MyFormatter(show_variables=True)), ) try:
bar()
tests/test_serializer.py:33: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def bar():
exec("foo()")
tests/samples/formatter_example.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
???
<string>:1: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
n = 5 def foo(n=5): if n > 0:
return foo(n - 1)
tests/samples/formatter_example.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
n = 4 def foo(n=5): if n > 0:
return foo(n - 1)
tests/samples/formatter_example.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
n = 3 def foo(n=5): if n > 0:
return foo(n - 1)
tests/samples/formatter_example.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
n = 2 def foo(n=5): if n > 0:
return foo(n - 1)
tests/samples/formatter_example.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
n = 1 def foo(n=5): if n > 0:
return foo(n - 1)
tests/samples/formatter_example.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
n = 0 def foo(n=5): if n > 0: return foo(n - 1) x = 1 lst = ( [ x, ] + [] + [] + [] + [] + [] ) try: return int(str(lst)) except: try: return 1 / 0 except Exception as e:
raise TypeError from e
E TypeError tests/samples/formatter_example.py:26: TypeError During handling of the above exception, another exception occurred: def test_example():from .samples.formatter_example import bar, format_frame, format_stack1
result = dict( format_frame=(format_frame(MyFormatter())), format_stack=format_stack1(MyFormatter(show_variables=True)), ) try: bar() except Exception: result.update(
pygmented=MyFormatter(show_variables=True, pygmented=True).format_exception(), pygmented_html=MyFormatter(show_variables=True, pygmented=True, html=True).format_exception(),plain=MyFormatter(show_variables=True).format_exception(),
)tests/test_serializer.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/stack_data/serializing.py:81: in format_exception
result = self.format_exception(e.__cause__)/usr/lib/python3/dist-packages/stack_data/serializing.py:84: in format_exception
result = self.format_exception(e.__context__)/usr/lib/python3/dist-packages/stack_data/serializing.py:87: in format_exception
result.append(self.format_traceback_part(e))_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_serializer.MyFormatter object at 0x7f367529f5d0> e = ValueError("invalid literal for int() with base 10: '[1]'") def format_traceback_part(self, e: BaseException) -> dict: return dict( frames=self.format_stack(e.__traceback__ or sys.exc_info()[2]), exception=dict( type=type(e).__name__,
message=traceback._some_str(e),
), tail="", ) E AttributeError: module 'traceback' has no attribute '_some_str' /usr/lib/python3/dist-packages/stack_data/serializing.py:95: AttributeError=============================== warnings summary ===============================
../../../../usr/lib/python3/dist-packages/pyximport/pyximport.py:51/usr/lib/python3/dist-packages/pyximport/pyximport.py:51: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html=========================== short test summary info ============================ FAILED tests/test_core.py::test_variables - AssertionError: assert None == <a... FAILED tests/test_core.py::test_example - assert 'bar at line ... \nx = 1 \n\... FAILED tests/test_core.py::test_pygments_example - AssertionError: assert 'Te...
FAILED tests/test_formatter.py::test_example - AssertionErrorFAILED tests/test_serializer.py::test_example - AttributeError: module 'trace... =================== 5 failed, 16 passed, 1 warning in 1.72s ====================
autopkgtest [00:15:02]: test pytest
OpenPGP_signature
Description: OpenPGP digital signature