msg261296 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2016-03-07 11:15 |
According to the docs [0], traceback.extract_tb should return 4-tuples (filename, line number, function name, text). [0] https://docs.python.org/3/library/traceback.html#traceback.extract_tb Instead, since Python 3.5, it returns FrameSummary objects, which are not tuples, nor tuple subclasses, nor even sequences. (This broke some code in the wild that called len() on FrameSummary.) Issue 25111 pointed out another tuple incompatibility, which was fixed. Should __len__ be added as well? Or the whole Sequence ABC? I can provide a patch when those questions are answered. |
|
|
msg261357 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2016-03-08 12:52 |
This is basically a duplicate of issue 25573. We need to add the examples in traceback module documentation to test_traceback.py. > Should __len__ be added as well? IMO, the new FrameSummary API (and its friends) shouldn't change the return value of the existing traceback functions like extract_tb() so I'd say yes. |
|
|
msg275356 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2016-09-09 17:35 |
I disagree that this is a duplicate. The question here is, should we add __len__? Since a FrameSummary object can be "cast into a tuple" and has a known len, I would say the answer is definitely yes. |
|
|
msg324937 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-09-10 17:02 |
New changeset 9797b7ae4496627836c55333765e10201a9840e3 by Petr Viktorin (Berker Peksag) in branch 'master': bpo-26502: Implement FrameSummary.__len__() (GH-8632) https://github.com/python/cpython/commit/9797b7ae4496627836c55333765e10201a9840e3 |
|
|
msg325036 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2018-09-11 17:33 |
Thanks for merging this, Petr. What do you think about backporting to 3.7? |
|
|
msg325038 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-09-11 17:49 |
I don't think I have a good enough feel for what should, generally, go to 3.7. So take my opinion with a grain of salt. But honestly, I don't think the issue is important enough -- I've only seen one codebase affected by it, which wasn't hard to fix. |
|
|
msg325040 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2018-09-11 17:54 |
Ok, let's close this issue then. |
|
|