Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue25111

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Broken compatibility in FrameSummary equality
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.6, Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: berker.peksag, python-dev, rbcollins, serhiy.storchaka, vstinner
Priority:normalKeywords:patch

Created on2015-09-14 17:48 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
traceback_FrameSummary_equality.patchserhiy.storchaka,2015-09-14 17:49review
traceback_FrameSummary_equality_2.patchserhiy.storchaka,2015-09-18 07:23review
Messages (7)
msg250693 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-09-14 17:48
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 andAttributeError: '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).
msg250953 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-09-18 07:23
Fixed patch and added tests.
msg251722 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-09-27 20:11
Ping.
msg251760 -(view)Author: Berker Peksag (berker.peksag)*(Python committer)Date: 2015-09-28 11:19
LGTM+        self.assertEqual(f, tuple(f))+        self.assertEqual(tuple(f), f)It would be good to add a comment to explain why we test both variants, but it's not really important.
msg251834 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2015-09-29 09:49
traceback_FrameSummary_equality_2.patch looks good to me, but I have the same remark than Berker (see the review).
msg251835 -(view)Author: Robert Collins (rbcollins)*(Python committer)Date: 2015-09-29 09:51
LGTM too.
msg251880 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-09-29 19:36
New changeset2ecb7d4d9e0b by Serhiy Storchaka in branch '3.5':Issue#25111: Fixed comparison of traceback.FrameSummary.https://hg.python.org/cpython/rev/2ecb7d4d9e0bNew changesetf043182a81d7 by Serhiy Storchaka in branch 'default':Issue#25111: Fixed comparison of traceback.FrameSummary.https://hg.python.org/cpython/rev/f043182a81d7
History
DateUserActionArgs
2022-04-11 14:58:21adminsetgithub: 69298
2015-09-29 19:37:09serhiy.storchakasetstatus: open -> closed
assignee:serhiy.storchaka
resolution: fixed
stage: commit review -> resolved
2015-09-29 19:36:33python-devsetnosy: +python-dev
messages: +msg251880
2015-09-29 09:51:29rbcollinssetmessages: +msg251835
2015-09-29 09:49:21vstinnersetnosy: +vstinner
messages: +msg251834
2015-09-28 11:19:13berker.peksagsetnosy: +berker.peksag

messages: +msg251760
stage: patch review -> commit review
2015-09-27 20:11:09serhiy.storchakasetmessages: +msg251722
2015-09-18 07:23:20serhiy.storchakasetfiles: +traceback_FrameSummary_equality_2.patch

messages: +msg250953
2015-09-14 17:49:00serhiy.storchakasetfiles: +traceback_FrameSummary_equality.patch
keywords: +patch
2015-09-14 17:48:43serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp