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
e953a723
Commit
e953a723
authored
Jan 01, 2017
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
6784be1d
6215e524
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
Lib/inspect.py
Lib/inspect.py
+1
-1
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+5
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/inspect.py
View file @
e953a723
...
...
@@ -1416,7 +1416,7 @@ def getframeinfo(frame, context=1):
except
OSError
:
lines
=
index
=
None
else
:
start
=
max
(
start
,
1
)
start
=
max
(
start
,
0
)
start
=
max
(
0
,
min
(
start
,
len
(
lines
)
-
context
))
lines
=
lines
[
start
:
start
+
context
]
index
=
lineno
-
1
-
start
...
...
Lib/test/test_inspect.py
View file @
e953a723
...
...
@@ -399,6 +399,11 @@ class TestRetrievingSourceCode(GetSourceBase):
# Check filename override
self
.
assertEqual
(
inspect
.
getmodule
(
None
,
modfile
),
mod
)
def
test_getframeinfo_get_first_line
(
self
):
frame_info
=
inspect
.
getframeinfo
(
self
.
fodderModule
.
fr
,
50
)
self
.
assertEqual
(
frame_info
.
code_context
[
0
],
"# line 1
\
n
"
)
self
.
assertEqual
(
frame_info
.
code_context
[
1
],
"'A module docstring.'
\
n
"
)
def
test_getsource
(
self
):
self
.
assertSourceEqual
(
git
.
abuse
,
29
,
39
)
self
.
assertSourceEqual
(
mod
.
StupidGit
,
21
,
51
)
...
...
Misc/NEWS
View file @
e953a723
...
...
@@ -208,6 +208,9 @@ Core and Builtins
Library
-------
-
Issue
#
15812
:
inspect
.
getframeinfo
()
now
correctly
shows
the
first
line
of
a
context
.
Patch
by
Sam
Breese
.
-
Issue
#
28985
:
Update
authorizer
constants
in
sqlite3
module
.
Patch
by
Dingyuan
Wang
.
...
...
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