-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Broken compatibility in FrameSummary equality #69298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Since 3.5 traceback.extract_tb() and traceback.extract_stack() return a list (actually list's subclass StackSummary) of FrameSummary objects instead of a list of tuples. FrameSummary is not fully compatible with tuple. One important incompatibility is in the comparing. >>> import traceback
>>> traceback.extract_stack()[0] == ('<stdin>', 1, '<module>', '')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython-3.5/Lib/traceback.py", line 254, in __eq__
return (self.filename == other.filename and
AttributeError: 'tuple' object has no attribute 'filename' In general __eq__ shouldn't raise an exception. bpo-25108 is needed to be fixed first for tests. Here is a patch that restores compatibility. An alternative solution would be to make FrameSummary a subclass of tuple (namedtuple). |
Fixed patch and added tests. |
Ping. |
LGTM + self.assertEqual(f, tuple(f)) It would be good to add a comment to explain why we test both variants, but it's not really important. |
traceback_FrameSummary_equality_2.patch looks good to me, but I have the same remark than Berker (see the review). |
LGTM too. |
New changeset 2ecb7d4d9e0b by Serhiy Storchaka in branch '3.5': New changeset f043182a81d7 by Serhiy Storchaka in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: