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
7491f172
Kaydet (Commit)
7491f172
authored
Agu 15, 2013
tarafından
Eric Snow
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
issue #18698: ensure importlib.reload() returns the module out of sys.modules.
üst
e76c0393
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
imp.py
Lib/imp.py
+3
-1
test_imp.py
Lib/test/test_imp.py
+17
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/imp.py
Dosyayı görüntüle @
7491f172
...
@@ -268,7 +268,9 @@ def reload(module):
...
@@ -268,7 +268,9 @@ def reload(module):
if
parent_name
and
parent_name
not
in
sys
.
modules
:
if
parent_name
and
parent_name
not
in
sys
.
modules
:
msg
=
"parent {!r} not in sys.modules"
msg
=
"parent {!r} not in sys.modules"
raise
ImportError
(
msg
.
format
(
parent_name
),
name
=
parent_name
)
raise
ImportError
(
msg
.
format
(
parent_name
),
name
=
parent_name
)
return
module
.
__loader__
.
load_module
(
name
)
module
.
__loader__
.
load_module
(
name
)
# The module may have replaced itself in sys.modules!
return
sys
.
modules
[
module
.
__name__
]
finally
:
finally
:
try
:
try
:
del
_RELOADING
[
name
]
del
_RELOADING
[
name
]
...
...
Lib/test/test_imp.py
Dosyayı görüntüle @
7491f172
...
@@ -5,6 +5,7 @@ import os.path
...
@@ -5,6 +5,7 @@ import os.path
import
shutil
import
shutil
import
sys
import
sys
from
test
import
support
from
test
import
support
from
test.test_importlib
import
util
import
unittest
import
unittest
import
warnings
import
warnings
...
@@ -285,6 +286,22 @@ class ReloadTests(unittest.TestCase):
...
@@ -285,6 +286,22 @@ class ReloadTests(unittest.TestCase):
with
self
.
assertRaisesRegex
(
ImportError
,
'html'
):
with
self
.
assertRaisesRegex
(
ImportError
,
'html'
):
imp
.
reload
(
parser
)
imp
.
reload
(
parser
)
def
test_module_replaced
(
self
):
# see #18698
def
code
():
module
=
type
(
sys
)(
'top_level'
)
module
.
spam
=
3
sys
.
modules
[
'top_level'
]
=
module
mock
=
util
.
mock_modules
(
'top_level'
,
module_code
=
{
'top_level'
:
code
})
with
mock
:
with
util
.
import_state
(
meta_path
=
[
mock
]):
module
=
importlib
.
import_module
(
'top_level'
)
reloaded
=
imp
.
reload
(
module
)
actual
=
sys
.
modules
[
'top_level'
]
self
.
assertEqual
(
actual
.
spam
,
3
)
self
.
assertEqual
(
reloaded
.
spam
,
3
)
class
PEP3147Tests
(
unittest
.
TestCase
):
class
PEP3147Tests
(
unittest
.
TestCase
):
"""Tests of PEP 3147."""
"""Tests of PEP 3147."""
...
...
Misc/NEWS
Dosyayı görüntüle @
7491f172
...
@@ -202,6 +202,8 @@ Library
...
@@ -202,6 +202,8 @@ Library
-
Issue
#
17269
:
Workaround
for
socket
.
getaddrinfo
crash
on
MacOS
X
-
Issue
#
17269
:
Workaround
for
socket
.
getaddrinfo
crash
on
MacOS
X
with
port
None
or
"0"
and
flags
AI_NUMERICSERV
.
with
port
None
or
"0"
and
flags
AI_NUMERICSERV
.
-
Issue
#
18698
:
Ensure
imp
.
reload
()
returns
the
module
out
of
sys
.
modules
.
-
Issue
#
18080
:
When
building
a
C
extension
module
on
OS
X
,
if
the
compiler
-
Issue
#
18080
:
When
building
a
C
extension
module
on
OS
X
,
if
the
compiler
is
overriden
with
the
CC
environment
variable
,
use
the
new
compiler
as
is
overriden
with
the
CC
environment
variable
,
use
the
new
compiler
as
the
default
for
linking
if
LDSHARED
is
not
also
overriden
.
This
restores
the
default
for
linking
if
LDSHARED
is
not
also
overriden
.
This
restores
...
...
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