Skip to content

traceback.walk_stack(None) yields frames from higher in the stack on 3.11 #99013

Closed
@graingert

Description

@graingert

eg:

Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import traceback
>>> list(traceback.walk_stack(None))
[]
>>> 
Python 3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:18:27) [GCC 10.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> list(traceback.walk_stack(None))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/graingert/anaconda3/envs/dask-distributed-311/lib/python3.11/traceback.py", line 332, in walk_stack
    f = sys._getframe().f_back.f_back.f_back.f_back
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'f_back'
>>> 

Originally posted by @graingert in #26958 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions