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
48fec053
Kaydet (Commit)
48fec053
authored
Agu 20, 2012
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Close #14846: Handle a sys.path entry going away
üst
db7920b9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
_bootstrap.py
Lib/importlib/_bootstrap.py
+5
-1
test_finder.py
Lib/test/test_importlib/source/test_finder.py
+12
-3
NEWS
Misc/NEWS
+3
-0
importlib.h
Python/importlib.h
+0
-0
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
48fec053
...
...
@@ -1367,7 +1367,11 @@ class FileFinder:
def
_fill_cache
(
self
):
"""Fill the cache of potential modules and packages for this directory."""
path
=
self
.
path
contents
=
_os
.
listdir
(
path
)
try
:
contents
=
_os
.
listdir
(
path
)
except
FileNotFoundError
:
# Directory has been removed since last import
contents
=
[]
# We store two cached versions, to handle runtime changes of the
# PYTHONCASEOK environment variable.
if
not
sys
.
platform
.
startswith
(
'win'
):
...
...
Lib/test/test_importlib/source/test_finder.py
Dosyayı görüntüle @
48fec053
...
...
@@ -35,13 +35,15 @@ class FinderTests(abc.FinderTests):
"""
def
import_
(
self
,
root
,
module
):
def
get_finder
(
self
,
root
):
loader_details
=
[(
machinery
.
SourceFileLoader
,
machinery
.
SOURCE_SUFFIXES
),
(
machinery
.
SourcelessFileLoader
,
machinery
.
BYTECODE_SUFFIXES
)]
finder
=
machinery
.
FileFinder
(
root
,
*
loader_details
)
return
finder
.
find_module
(
module
)
return
machinery
.
FileFinder
(
root
,
*
loader_details
)
def
import_
(
self
,
root
,
module
):
return
self
.
get_finder
(
root
)
.
find_module
(
module
)
def
run_test
(
self
,
test
,
create
=
None
,
*
,
compile_
=
None
,
unlink
=
None
):
"""Test the finding of 'test' with the creation of modules listed in
...
...
@@ -137,6 +139,13 @@ class FinderTests(abc.FinderTests):
finder
.
invalidate_caches
()
self
.
assertEqual
(
finder
.
_path_mtime
,
-
1
)
# Regression test for http://bugs.python.org/issue14846
def
test_dir_removal_handling
(
self
):
mod
=
'mod'
with
source_util
.
create_modules
(
mod
)
as
mapping
:
finder
=
self
.
get_finder
(
mapping
[
'.root'
])
self
.
assertIsNotNone
(
finder
.
find_module
(
mod
))
self
.
assertIsNone
(
finder
.
find_module
(
mod
))
def
test_main
():
from
test.support
import
run_unittest
...
...
Misc/NEWS
Dosyayı görüntüle @
48fec053
...
...
@@ -13,6 +13,9 @@ Core and Builtins
- Issue #15604: Update uses of PyObject_IsTrue() to check for and handle
errors correctly. Patch by Serhiy Storchaka.
- Issue #14846: importlib.FileFinder now handles the case where the
directory being searched is removed after a previous import attempt
Library
-------
...
...
Python/importlib.h
Dosyayı görüntüle @
48fec053
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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