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
055a9e0b
Kaydet (Commit)
055a9e0b
authored
Eyl 06, 2015
tarafından
Larry Hastings
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merged in ncoghlan/cpython350 (pull request #17)
üst
69953421
9d3c61c8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
1 deletion
+49
-1
imp.py
Lib/imp.py
+7
-1
imp_dummy.py
Lib/test/imp_dummy.py
+3
-0
test_imp.py
Lib/test/test_imp.py
+24
-0
NEWS
Misc/NEWS
+5
-0
_testmultiphase.c
Modules/_testmultiphase.c
+10
-0
No files found.
Lib/imp.py
Dosyayı görüntüle @
055a9e0b
...
...
@@ -334,6 +334,12 @@ if create_dynamic:
"""
import
importlib.machinery
loader
=
importlib
.
machinery
.
ExtensionFileLoader
(
name
,
path
)
return
loader
.
load_module
()
# Issue #24748: Skip the sys.modules check in _load_module_shim;
# always load new extension
spec
=
importlib
.
machinery
.
ModuleSpec
(
name
=
name
,
loader
=
loader
,
origin
=
path
)
return
_load
(
spec
)
else
:
load_dynamic
=
None
Lib/test/imp_dummy.py
0 → 100644
Dosyayı görüntüle @
055a9e0b
# Fodder for test of issue24748 in test_imp
dummy_name
=
True
Lib/test/test_imp.py
Dosyayı görüntüle @
055a9e0b
...
...
@@ -3,6 +3,7 @@ try:
except
ImportError
:
_thread
=
None
import
importlib
import
importlib.util
import
os
import
os.path
import
shutil
...
...
@@ -275,6 +276,29 @@ class ImportTests(unittest.TestCase):
self
.
skipTest
(
"found module doesn't appear to be a C extension"
)
imp
.
load_module
(
name
,
None
,
*
found
[
1
:])
@requires_load_dynamic
def
test_issue24748_load_module_skips_sys_modules_check
(
self
):
name
=
'test.imp_dummy'
try
:
del
sys
.
modules
[
name
]
except
KeyError
:
pass
try
:
module
=
importlib
.
import_module
(
name
)
spec
=
importlib
.
util
.
find_spec
(
'_testmultiphase'
)
module
=
imp
.
load_dynamic
(
name
,
spec
.
origin
)
self
.
assertEqual
(
module
.
__name__
,
name
)
self
.
assertEqual
(
module
.
__spec__
.
name
,
name
)
self
.
assertEqual
(
module
.
__spec__
.
origin
,
spec
.
origin
)
self
.
assertRaises
(
AttributeError
,
getattr
,
module
,
'dummy_name'
)
self
.
assertEqual
(
module
.
int_const
,
1969
)
self
.
assertIs
(
sys
.
modules
[
name
],
module
)
finally
:
try
:
del
sys
.
modules
[
name
]
except
KeyError
:
pass
@unittest.skipIf
(
sys
.
dont_write_bytecode
,
"test meaningful only when writing bytecode"
)
def
test_bug7732
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
055a9e0b
...
...
@@ -17,6 +17,11 @@ Core and Builtins
Library
-------
- Issue #24748: To resolve a compatibility problem found with py2exe and
pywin32, imp.load_dynamic() once again ignores previously loaded modules
to support Python modules replacing themselves with extension modules.
Patch by Petr Viktorin.
- Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.
- Issue #24635: Fixed a bug in typing.py where isinstance([], typing.Iterable)
...
...
Modules/_testmultiphase.c
Dosyayı görüntüle @
055a9e0b
...
...
@@ -582,3 +582,13 @@ PyInit__testmultiphase_exec_unreported_exception(PyObject *spec)
{
return
PyModuleDef_Init
(
&
def_exec_unreported_exception
);
}
/*** Helper for imp test ***/
static
PyModuleDef
imp_dummy_def
=
TEST_MODULE_DEF
(
"imp_dummy"
,
main_slots
,
testexport_methods
);
PyMODINIT_FUNC
PyInit_imp_dummy
(
PyObject
*
spec
)
{
return
PyModuleDef_Init
(
&
imp_dummy_def
);
}
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