New GitHub issue #95818 from Themanwithoutaplan:<br>
<hr>
<pre>
# Bug report
I've recently been getting test failures, including segmentation faults, on different arcs (MacOS, Docker images) with Python 3.11 beta. The test itself is not at fault so I guess it's some kind of runtime issue.
```python
Here's the traceback:
________________________ test_read_single_cell_formula[False-='Sheet2 - Numbers'!D5] ________________________
exc = <class 'ResourceWarning'>
value = ResourceWarning("unclosed file <_io.BufferedReader name='sample.xlsx'>")
tb = <traceback object at 0x10e3f4b00>, limit = None, chain = True
def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
chain=True):
"""Format a stack trace and the exception information.
The arguments have the same meaning as the corresponding arguments
to print_exception(). The return value is a list of strings, each
ending in a newline and some containing internal newlines. When
these lines are concatenated and printed, exactly the same text is
printed as does print_exception().
"""
value, tb = _parse_value_tb(exc, value, tb)
> te = TracebackException(type(value), value, tb, limit=limit, compact=True)
chain = True
exc = <class 'ResourceWarning'>
limit = None
tb = <traceback object at 0x10e3f4b00>
value = ResourceWarning("unclosed file <_io.BufferedReader name='sample.xlsx'>")
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/traceback.py:139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/traceback.py:688: in __init__
self.stack = StackSummary._extract_from_extended_frame_gen(
_seen = {4539126048}
capture_locals = False
compact = True
exc_traceback = <traceback object at 0x10e3f4b00>
exc_type = <class 'ResourceWarning'>
exc_value = ResourceWarning("unclosed file <_io.BufferedReader name='sample.xlsx'>")
is_recursive_call = False
limit = None
lookup_lines = True
max_group_depth = 10
max_group_width = 15
self = <traceback.TracebackException object at 0x10e4029d0>
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/traceback.py:416: in _extract_from_extended_frame_gen
for f, (lineno, end_lineno, colno, end_colno) in frame_gen:
capture_locals = False
fnames = set()
frame_gen = <generator object _walk_tb_with_full_positions at 0x10d50c3c0>
klass = <class 'traceback.StackSummary'>
limit = None
lookup_lines = True
result = []
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tb = <traceback object at 0x10e3f4b00>
def _walk_tb_with_full_positions(tb):
# Internal version of walk_tb that yields full code positions including
# end line and column information.
while tb is not None:
> positions = _get_code_position(tb.tb_frame.f_code, tb.tb_lasti)
E AttributeError: 'frozenset' object has no attribute 'f_code'
tb = <traceback object at 0x10e3f4b00>
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/traceback.py:353: AttributeError
========================================== short test summary info ==========================================
FAILED openpyxl/tests/test_iter.py::test_read_single_cell_formula[False-='Sheet2 - Numbers'!D5] - Attribut...
=========================== 1 failed, 2467 passed, 16 skipped, 6 xfailed in 8.24s ===========================
ERROR: InvocationError for command /Users/charlieclark/Projects/openpyxl/.tox/py311/bin/pytest openpyxl (exited with code 1)
__________________________________________________ summary __________________________________________________
ERROR: py311: commands failed
```
And an example from the Docker image at https://foss.heptapod.net/openpyxl/openpyxl/-/jobs/618571
# Your environment
MacOS 10.15, official docker image (slim)
Python 3.11 beta 4 & 5
I suspect the issue is somewhere between pytest and Python3.11
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/95818">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>