https://bugzilla.redhat.com/show_bug.cgi?id=2069709
Bug ID: 2069709 Summary: python-stack-data fails to build with Python 3.11: executing.executing.NotOneValueFound: Expected one value, found 0 Product: Fedora Version: rawhide Status: NEW Component: python-stack-data Assignee: lbalhar@redhat.com Reporter: thrnciar@redhat.com CC: epel-packagers-sig@lists.fedoraproject.org, lbalhar@redhat.com, mhroncok@redhat.com, michel@michel-slm.name, thrnciar@redhat.com Blocks: 2016048 (PYTHON3.11) Target Milestone: --- Classification: Fedora
python-stack-data fails to build with Python 3.11.0a6.
=================================== FAILURES =================================== _________________________________ test_example _________________________________
def test_example(): from .samples.example import bar
result = bar()
tests/test_core.py:573: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/samples/example.py:27: in bar exec("result = foo()", globals(), names) <string>:1: in <module> ??? tests/samples/example.py:20: in foo result = print_stack( tests/samples/example.py:35: in print_stack for frame_info in list(FrameInfo.stack_data(frame, options))[-3:]: /usr/lib/python3.11/site-packages/typeguard/__init__.py:897: in __next__ return self.send(None) /usr/lib/python3.11/site-packages/typeguard/__init__.py:915: in send value = self.__wrapped.send(obj) stack_data/core.py:565: in stack_data yield from collapse_repeated( stack_data/utils.py:84: in collapse_repeated yield from map(mapper, original_group) stack_data/core.py:555: in mapper return cls(f, options) /usr/lib/python3.11/site-packages/typeguard/__init__.py:1033: in wrapper retval = func(*args, **kwargs) stack_data/core.py:520: in __init__ self.executing = Source.executing(frame_or_tb) /usr/lib/python3.11/site-packages/executing/executing.py:335: in executing node = find_node(lasti) /usr/lib/python3.11/site-packages/executing/executing.py:321: in find_node return only( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
it = <generator object Source.executing.<locals>.find_node.<locals>.<genexpr> at 0x7f8a614b36a0>
def only(it): if hasattr(it, '__len__'): if len(it) != 1: raise NotOneValueFound('Expected one value, found %s' % len(it)) # noinspection PyTypeChecker return list(it)[0]
lst = tuple(islice(it, 2)) if len(lst) == 0:
raise NotOneValueFound('Expected one value, found 0')
E executing.executing.NotOneValueFound: Expected one value, found 0
/usr/lib/python3.11/site-packages/executing/executing.py:164: NotOneValueFound ____________________________ test_pygments_example _____________________________
def test_pygments_example(): from .samples.pygments_example import bar
result = bar()
tests/test_core.py:618: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/samples/pygments_example.py:17: in bar @deco tests/samples/pygments_example.py:26: in deco f.result = print_stack() tests/samples/pygments_example.py:43: in print_stack for frame_info in list(FrameInfo.stack_data(frame, options))[-2:]: /usr/lib/python3.11/site-packages/typeguard/__init__.py:897: in __next__ return self.send(None) /usr/lib/python3.11/site-packages/typeguard/__init__.py:915: in send value = self.__wrapped.send(obj) stack_data/core.py:565: in stack_data yield from collapse_repeated( stack_data/utils.py:84: in collapse_repeated yield from map(mapper, original_group) stack_data/core.py:555: in mapper return cls(f, options) /usr/lib/python3.11/site-packages/typeguard/__init__.py:1033: in wrapper retval = func(*args, **kwargs) stack_data/core.py:520: in __init__ self.executing = Source.executing(frame_or_tb) /usr/lib/python3.11/site-packages/executing/executing.py:354: in executing opname(index - 2) == "PRECALL_FUNCTION" _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
i = 44
def opname(i):
return bc_list[i // 2].opname
E IndexError: list index out of range
/usr/lib/python3.11/site-packages/executing/executing.py:346: IndexError _________________________________ 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:
capsys = <_pytest.capture.CaptureFixture object at 0x7f8a618fc490>
def test_example(capsys): from .samples.formatter_example import bar, print_stack1, format_stack1, format_frame, f_string
@contextmanager def check_example(name): yield stderr = capsys.readouterr().err compare_to_file(stderr, name)
with check_example("variables"): try:
bar()
tests/test_formatter.py:40: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:
capsys = <_pytest.capture.CaptureFixture object at 0x7f8a618fc490>
def test_example(capsys): from .samples.formatter_example import bar, print_stack1, format_stack1, format_frame, f_string
@contextmanager def check_example(name): yield stderr = capsys.readouterr().err compare_to_file(stderr, name)
with check_example("variables"): try: bar() except Exception:
MyFormatter(show_variables=True).print_exception()
tests/test_formatter.py:42: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stack_data/formatting.py:72: in print_exception self.print_lines(self.format_exception(e), file=file) stack_data/formatting.py:83: in print_lines for line in lines: /usr/lib/python3.11/site-packages/typeguard/__init__.py:897: in __next__ return self.send(None) /usr/lib/python3.11/site-packages/typeguard/__init__.py:915: in send value = self.__wrapped.send(obj) stack_data/formatting.py:100: in format_exception yield from self.format_stack(e.__traceback__) /usr/lib/python3.11/site-packages/typeguard/__init__.py:897: in __next__ return self.send(None) /usr/lib/python3.11/site-packages/typeguard/__init__.py:915: in send value = self.__wrapped.send(obj) stack_data/formatting.py:107: in format_stack yield from self.format_stack_data( /usr/lib/python3.11/site-packages/typeguard/__init__.py:897: in __next__ return self.send(None) /usr/lib/python3.11/site-packages/typeguard/__init__.py:915: in send value = self.__wrapped.send(obj) stack_data/formatting.py:118: in format_stack_data for item in stack: /usr/lib/python3.11/site-packages/typeguard/__init__.py:897: in __next__ return self.send(None) /usr/lib/python3.11/site-packages/typeguard/__init__.py:915: in send value = self.__wrapped.send(obj) stack_data/core.py:565: in stack_data yield from collapse_repeated( stack_data/utils.py:84: in collapse_repeated yield from map(mapper, original_group) stack_data/core.py:555: in mapper return cls(f, options) /usr/lib/python3.11/site-packages/typeguard/__init__.py:1033: in wrapper retval = func(*args, **kwargs) stack_data/core.py:520: in __init__ self.executing = Source.executing(frame_or_tb) /usr/lib/python3.11/site-packages/executing/executing.py:335: in executing node = find_node(lasti) /usr/lib/python3.11/site-packages/executing/executing.py:321: in find_node return only( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
it = <generator object Source.executing.<locals>.find_node.<locals>.<genexpr> at 0x7f8a5ef609a0>
def only(it): if hasattr(it, '__len__'): if len(it) != 1: raise NotOneValueFound('Expected one value, found %s' % len(it)) # noinspection PyTypeChecker return list(it)[0]
lst = tuple(islice(it, 2)) if len(lst) == 0:
raise NotOneValueFound('Expected one value, found 0')
E executing.executing.NotOneValueFound: Expected one value, found 0
/usr/lib/python3.11/site-packages/executing/executing.py:164: NotOneValueFound ----------------------------- Captured stderr call ----------------------------- Traceback (most recent call last): File "formatter_example.py", line 21, in foo 9 | x = 1 10 | lst = ( 11 | [ 12 | x, (...) 18 | + [] 19 | ) 20 | try: --> 21 | return int(str(lst)) ^^^^^^^^^^^^^ 22 | except: [ x, ] = [1] [ x, ] + [] = [1] [ x, ] + [] + [] = [1] [ x, ] + [] + [] + [] = [1] [ x, ] + [] + [] + [] + [] = [1] [ x, ] + [] + [] + [] + [] + [] = [1] lst = [1] n = 0 n - 1 = -1 n > 0 = False str(lst) = '[1]' x = 1 ValueError: invalid literal for int() with base 10: '[1]'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "formatter_example.py", line 24, in foo 21 | return int(str(lst)) 22 | except: 23 | try: --> 24 | return 1 / 0 ^^^^^ 25 | except Exception as e: [ x, ] = [1] [ x, ] + [] = [1] [ x, ] + [] + [] = [1] [ x, ] + [] + [] + [] = [1] [ x, ] + [] + [] + [] + [] = [1] [ x, ] + [] + [] + [] + [] + [] = [1] lst = [1] n = 0 n - 1 = -1 n > 0 = False str(lst) = '[1]' x = 1 ZeroDivisionError: division by zero
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "formatter_example.py", line 30, in bar 29 | def bar(): --> 30 | exec("foo()") ^^^^^^^^^^^^^ =============================== warnings summary =============================== ../../../../usr/lib64/python3.11/site-packages/pyximport/pyximport.py:51 /usr/lib64/python3.11/site-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_example - executing.executing.NotOneValueFoun... FAILED tests/test_core.py::test_pygments_example - IndexError: list index out... FAILED tests/test_formatter.py::test_example - executing.executing.NotOneValu... =================== 3 failed, 13 passed, 1 warning in 3.03s ==================== ERROR: InvocationError for command /usr/bin/pytest (exited with code 1) ___________________________________ summary ____________________________________ ERROR: py311: commands failed
https://docs.python.org/3.11/whatsnew/3.11.html
For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-ra...
For all our attempts to build python-stack-data with Python 3.11, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-s...
Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/
Let us know here if you have any questions.
Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
Referenced Bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=2016048 [Bug 2016048] Python 3.11
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
Miro Hrončok mhroncok@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|unspecified |high
--- Comment #1 from Miro Hrončok mhroncok@redhat.com --- This blocks ipython.
I have not yet investigated all 3 failures, but at least some seem to be related to the new extended traceback.
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
--- Comment #2 from Lumír Balhar lbalhar@redhat.com --- I have created an upstream issue: https://github.com/alexmojaki/stack_data/issues/25
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
--- Comment #3 from Lumír Balhar lbalhar@redhat.com --- The core of the problem lies very likely in python-executing. There is a WIP upstream patch for python-executing and we have it in the COPR but it's not complete enough to make stack-data work properly with Python 3.11. I've pinged there. Unfortunately, my understanding of those projects is not deep enough to help with the troubles but if it's a really high priority, I can make it a priority on my ToDo.
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
--- Comment #4 from Miro Hrončok mhroncok@redhat.com --- It is a high priority to make ipython work.
ipython requires python3-stack-data on runtime. Whether or not we can afford to skip some tests here (and whether or not it breaks ipython on runtime) we still need to figure out.
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
--- Comment #5 from Lumír Balhar lbalhar@redhat.com --- I did some manual testing and it seems that ipython works well with the latest releases of executing and stack_data. Also, almost all tests are passing for ipython with Python 3.11 (none fail, some doctests are skipped). Stack_data is used only for limited functionalities in ipython and it seems that its incompatibility with Python 3.11 has no impact on ipython. I'd therefore skip tests for stack_data and executing and build ipython with tests to unblock the dependant packages.
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
Miro Hrončok mhroncok@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|lbalhar@redhat.com |mhroncok@redhat.com
--- Comment #6 from Miro Hrončok mhroncok@redhat.com --- Thank you for checking. I'll do that.
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
Miro Hrončok mhroncok@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |POST
--- Comment #7 from Miro Hrončok mhroncok@redhat.com --- https://src.fedoraproject.org/rpms/python-stack-data/pull-request/4
https://bugzilla.redhat.com/show_bug.cgi?id=2069709
Lumír Balhar lbalhar@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |RAWHIDE Status|POST |CLOSED Last Closed| |2022-03-30 18:31:04
--- Comment #8 from Lumír Balhar lbalhar@redhat.com --- Thanks for the hotfix.
https://bugzilla.redhat.com/show_bug.cgi?id=2069709 Bug 2069709 depends on bug 2068421, which changed state.
Bug 2068421 Summary: python-executing fails to build with Python 3.11: InvocationError: self.get_executing(inspect.currentframe().f_back) https://bugzilla.redhat.com/show_bug.cgi?id=2068421
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CLOSED Resolution|--- |RAWHIDE
epel-packagers-sig@lists.stg.fedoraproject.org