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
72ae6c80
Commit
72ae6c80
authored
Apr 30, 2006
by
Phillip J. Eby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix infinite regress when inspecting <string> or <stdin> frames.
parent
de9b624f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
Lib/inspect.py
Lib/inspect.py
+7
-1
No files found.
Lib/inspect.py
View file @
72ae6c80
...
...
@@ -353,7 +353,13 @@ def getsourcefile(object):
if
'b'
in
mode
and
string
.
lower
(
filename
[
-
len
(
suffix
):])
==
suffix
:
# Looks like a binary file. We want to only return a text file.
return
None
if
os
.
path
.
exists
(
filename
)
or
hasattr
(
getmodule
(
object
),
'__loader__'
):
if
os
.
path
.
exists
(
filename
):
return
filename
# Ugly but necessary - '<stdin>' and '<string>' mean that getmodule()
# would infinitely recurse, because they're not real files nor loadable
# Note that this means that writing a PEP 302 loader that uses '<'
# at the start of a filename is now not a good idea. :(
if
filename
[:
1
]
!=
'<'
and
hasattr
(
getmodule
(
object
),
'__loader__'
):
return
filename
def
getabsfile
(
object
):
...
...
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