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
f0cfdf73
Kaydet (Commit)
f0cfdf73
authored
Eyl 19, 2002
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fiddle comments and variable names in whichmodule().
üst
065a5ab8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
pickle.py
Lib/pickle.py
+10
-11
No files found.
Lib/pickle.py
Dosyayı görüntüle @
f0cfdf73
...
@@ -611,30 +611,29 @@ def _keep_alive(x, memo):
...
@@ -611,30 +611,29 @@ def _keep_alive(x, memo):
memo
[
id
(
memo
)]
=
[
x
]
memo
[
id
(
memo
)]
=
[
x
]
classmap
=
{}
classmap
=
{}
# called classmap for backwards compatibility
# This is no longer used to find classes, but still for functions
def
whichmodule
(
func
,
funcname
):
def
whichmodule
(
cls
,
clsname
):
"""Figure out the module in which a function occurs.
"""Figure out the module in which a class occurs.
Search sys.modules for the module.
Search sys.modules for the module.
Cache in classmap.
Cache in classmap.
Return a module name.
Return a module name.
If the
class
cannot be found, return __main__.
If the
function
cannot be found, return __main__.
"""
"""
if
cls
in
classmap
:
if
func
in
classmap
:
return
classmap
[
cls
]
return
classmap
[
func
]
for
name
,
module
in
sys
.
modules
.
items
():
for
name
,
module
in
sys
.
modules
.
items
():
if
module
is
None
:
if
module
is
None
:
continue
# skip dummy package entries
continue
# skip dummy package entries
if
name
!=
'__main__'
and
\
if
name
!=
'__main__'
and
\
hasattr
(
module
,
cls
name
)
and
\
hasattr
(
module
,
func
name
)
and
\
getattr
(
module
,
clsname
)
is
cls
:
getattr
(
module
,
funcname
)
is
func
:
break
break
else
:
else
:
name
=
'__main__'
name
=
'__main__'
classmap
[
cls
]
=
name
classmap
[
func
]
=
name
return
name
return
name
...
...
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