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
589c4fff
Kaydet (Commit)
589c4fff
authored
Haz 15, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make it more obvious what things used in imp are snuck in through private APIs
üst
a3c96154
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
imp.py
Lib/imp.py
+8
-11
No files found.
Lib/imp.py
Dosyayı görüntüle @
589c4fff
...
@@ -16,11 +16,9 @@ except ModuleNotFoundError:
...
@@ -16,11 +16,9 @@ except ModuleNotFoundError:
# Platform doesn't support dynamic loading.
# Platform doesn't support dynamic loading.
load_dynamic
=
None
load_dynamic
=
None
# Directly exposed by this module
from
importlib._bootstrap
import
(
cache_from_source
,
source_from_cache
,
from
importlib._bootstrap
import
cache_from_source
,
source_from_cache
SourcelessFileLoader
,
_ERR_MSG
)
from
importlib
import
_bootstrap
from
importlib
import
machinery
from
importlib
import
machinery
from
importlib
import
util
from
importlib
import
util
import
importlib
import
importlib
...
@@ -117,7 +115,7 @@ class _HackedGetData:
...
@@ -117,7 +115,7 @@ class _HackedGetData:
return
super
()
.
get_data
(
path
)
return
super
()
.
get_data
(
path
)
class
_LoadSourceCompatibility
(
_HackedGetData
,
_bootstrap
.
SourceFileLoader
):
class
_LoadSourceCompatibility
(
_HackedGetData
,
machinery
.
SourceFileLoader
):
"""Compatibility support for implementing load_source()."""
"""Compatibility support for implementing load_source()."""
...
@@ -131,12 +129,11 @@ def load_source(name, pathname, file=None):
...
@@ -131,12 +129,11 @@ def load_source(name, pathname, file=None):
module
=
sys
.
modules
[
name
]
module
=
sys
.
modules
[
name
]
# To allow reloading to potentially work, use a non-hacked loader which
# To allow reloading to potentially work, use a non-hacked loader which
# won't rely on a now-closed file object.
# won't rely on a now-closed file object.
module
.
__loader__
=
_bootstrap
.
SourceFileLoader
(
name
,
pathname
)
module
.
__loader__
=
machinery
.
SourceFileLoader
(
name
,
pathname
)
return
module
return
module
class
_LoadCompiledCompatibility
(
_HackedGetData
,
class
_LoadCompiledCompatibility
(
_HackedGetData
,
SourcelessFileLoader
):
_bootstrap
.
SourcelessFileLoader
):
"""Compatibility support for implementing load_compiled()."""
"""Compatibility support for implementing load_compiled()."""
...
@@ -150,7 +147,7 @@ def load_compiled(name, pathname, file=None):
...
@@ -150,7 +147,7 @@ def load_compiled(name, pathname, file=None):
module
=
sys
.
modules
[
name
]
module
=
sys
.
modules
[
name
]
# To allow reloading to potentially work, use a non-hacked loader which
# To allow reloading to potentially work, use a non-hacked loader which
# won't rely on a now-closed file object.
# won't rely on a now-closed file object.
module
.
__loader__
=
_bootstrap
.
SourcelessFileLoader
(
name
,
pathname
)
module
.
__loader__
=
SourcelessFileLoader
(
name
,
pathname
)
return
module
return
module
...
@@ -168,7 +165,7 @@ def load_package(name, path):
...
@@ -168,7 +165,7 @@ def load_package(name, path):
break
break
else
:
else
:
raise
ValueError
(
'{!r} is not a package'
.
format
(
path
))
raise
ValueError
(
'{!r} is not a package'
.
format
(
path
))
return
_bootstrap
.
SourceFileLoader
(
name
,
path
)
.
load_module
(
name
)
return
machinery
.
SourceFileLoader
(
name
,
path
)
.
load_module
(
name
)
def
load_module
(
name
,
file
,
filename
,
details
):
def
load_module
(
name
,
file
,
filename
,
details
):
...
@@ -252,7 +249,7 @@ def find_module(name, path=None):
...
@@ -252,7 +249,7 @@ def find_module(name, path=None):
continue
continue
break
# Break out of outer loop when breaking out of inner loop.
break
# Break out of outer loop when breaking out of inner loop.
else
:
else
:
raise
ImportError
(
_
bootstrap
.
_
ERR_MSG
.
format
(
name
),
name
=
name
)
raise
ImportError
(
_ERR_MSG
.
format
(
name
),
name
=
name
)
encoding
=
None
encoding
=
None
if
mode
==
'U'
:
if
mode
==
'U'
:
...
...
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