Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7a25765f
Kaydet (Commit)
7a25765f
authored
Mar 02, 2001
tarafından
Ka-Ping Yee
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
When seeking the module for an object, compare absolute (not relative) paths.
üst
a2fe103c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
inspect.py
Lib/inspect.py
+4
-3
No files found.
Lib/inspect.py
Dosyayı görüntüle @
7a25765f
...
@@ -27,7 +27,7 @@ Here are some of the useful functions provided by this module:
...
@@ -27,7 +27,7 @@ Here are some of the useful functions provided by this module:
__author__
=
'Ka-Ping Yee <ping@lfw.org>'
__author__
=
'Ka-Ping Yee <ping@lfw.org>'
__date__
=
'1 Jan 2001'
__date__
=
'1 Jan 2001'
import
sys
,
types
,
string
,
dis
,
imp
,
tokenize
import
sys
,
os
,
types
,
string
,
dis
,
imp
,
tokenize
# ----------------------------------------------------------- type-checking
# ----------------------------------------------------------- type-checking
def
ismodule
(
object
):
def
ismodule
(
object
):
...
@@ -199,14 +199,15 @@ def getmodule(object):
...
@@ -199,14 +199,15 @@ def getmodule(object):
if
isclass
(
object
):
if
isclass
(
object
):
return
sys
.
modules
.
get
(
object
.
__module__
)
return
sys
.
modules
.
get
(
object
.
__module__
)
try
:
try
:
file
=
getsourcefile
(
object
)
file
=
os
.
path
.
abspath
(
getsourcefile
(
object
)
)
except
TypeError
:
except
TypeError
:
return
None
return
None
if
modulesbyfile
.
has_key
(
file
):
if
modulesbyfile
.
has_key
(
file
):
return
sys
.
modules
[
modulesbyfile
[
file
]]
return
sys
.
modules
[
modulesbyfile
[
file
]]
for
module
in
sys
.
modules
.
values
():
for
module
in
sys
.
modules
.
values
():
if
hasattr
(
module
,
'__file__'
):
if
hasattr
(
module
,
'__file__'
):
modulesbyfile
[
getsourcefile
(
module
)]
=
module
.
__name__
modulesbyfile
[
os
.
path
.
abspath
(
getsourcefile
(
module
))]
=
module
.
__name__
if
modulesbyfile
.
has_key
(
file
):
if
modulesbyfile
.
has_key
(
file
):
return
sys
.
modules
[
modulesbyfile
[
file
]]
return
sys
.
modules
[
modulesbyfile
[
file
]]
main
=
sys
.
modules
[
'__main__'
]
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