New submission from Serhiy Storchaka:

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. Issue25108 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).

----------
components: Library (Lib)
messages: 250693
nosy: rbcollins, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Broken compatibility in FrameSummary equality
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25111>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to