Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9797b7ae
Commit
9797b7ae
authored
Sep 10, 2018
by
Berker Peksag
Committed by
Petr Viktorin
Sep 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-26502: Implement FrameSummary.__len__() (GH-8632)
parent
0e0bc4e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
Lib/test/test_traceback.py
Lib/test/test_traceback.py
+5
-0
Lib/traceback.py
Lib/traceback.py
+3
-0
Misc/NEWS.d/next/Library/2018-08-02-20-39-32.bpo-26502.eGXr_k.rst
...S.d/next/Library/2018-08-02-20-39-32.bpo-26502.eGXr_k.rst
+2
-0
No files found.
Lib/test/test_traceback.py
View file @
9797b7ae
...
...
@@ -868,6 +868,7 @@ class MiscTracebackCases(unittest.TestCase):
(
__file__
,
lineno
+
2
,
'test_extract_stack'
,
'result = extract()'
),
(
__file__
,
lineno
+
1
,
'extract'
,
'return traceback.extract_stack()'
),
])
self
.
assertEqual
(
len
(
result
[
0
]),
4
)
class
TestFrame
(
unittest
.
TestCase
):
...
...
@@ -900,6 +901,10 @@ class TestFrame(unittest.TestCase):
f
=
traceback
.
FrameSummary
(
"f"
,
1
,
"dummy"
,
line
=
"line"
)
self
.
assertEqual
(
"line"
,
f
.
line
)
def
test_len
(
self
):
f
=
traceback
.
FrameSummary
(
"f"
,
1
,
"dummy"
,
line
=
"line"
)
self
.
assertEqual
(
len
(
f
),
4
)
class
TestStack
(
unittest
.
TestCase
):
...
...
Lib/traceback.py
View file @
9797b7ae
...
...
@@ -279,6 +279,9 @@ class FrameSummary:
return
"<FrameSummary file {filename}, line {lineno} in {name}>"
.
format
(
filename
=
self
.
filename
,
lineno
=
self
.
lineno
,
name
=
self
.
name
)
def
__len__
(
self
):
return
4
@
property
def
line
(
self
):
if
self
.
_line
is
None
:
...
...
Misc/NEWS.d/next/Library/2018-08-02-20-39-32.bpo-26502.eGXr_k.rst
0 → 100644
View file @
9797b7ae
Implement ``traceback.FrameSummary.__len__()`` method to preserve
compatibility with the old tuple API.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment