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
7a25765f
Commit
7a25765f
authored
Mar 02, 2001
by
Ka-Ping Yee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When seeking the module for an object, compare absolute (not relative) paths.
parent
a2fe103c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Lib/inspect.py
Lib/inspect.py
+4
-3
No files found.
Lib/inspect.py
View file @
7a25765f
...
...
@@ -27,7 +27,7 @@ Here are some of the useful functions provided by this module:
__author__
=
'Ka-Ping Yee <ping@lfw.org>'
__date__
=
'1 Jan 2001'
import
sys
,
types
,
string
,
dis
,
imp
,
tokenize
import
sys
,
os
,
types
,
string
,
dis
,
imp
,
tokenize
# ----------------------------------------------------------- type-checking
def
ismodule
(
object
):
...
...
@@ -199,14 +199,15 @@ def getmodule(object):
if
isclass
(
object
):
return
sys
.
modules
.
get
(
object
.
__module__
)
try
:
file
=
getsourcefile
(
object
)
file
=
os
.
path
.
abspath
(
getsourcefile
(
object
)
)
except
TypeError
:
return
None
if
modulesbyfile
.
has_key
(
file
):
return
sys
.
modules
[
modulesbyfile
[
file
]]
for
module
in
sys
.
modules
.
values
():
if
hasattr
(
module
,
'__file__'
):
modulesbyfile
[
getsourcefile
(
module
)]
=
module
.
__name__
modulesbyfile
[
os
.
path
.
abspath
(
getsourcefile
(
module
))]
=
module
.
__name__
if
modulesbyfile
.
has_key
(
file
):
return
sys
.
modules
[
modulesbyfile
[
file
]]
main
=
sys
.
modules
[
'__main__'
]
...
...
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