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
c57f9f94
Kaydet (Commit)
c57f9f94
authored
Ock 11, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge from 3.3 for fix for issue #16730
üst
b463c482
a9976b3e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
2 deletions
+43
-2
_bootstrap.py
Lib/importlib/_bootstrap.py
+3
-2
test_finder.py
Lib/test/test_importlib/source/test_finder.py
+35
-0
NEWS
Misc/NEWS
+5
-0
importlib.h
Python/importlib.h
+0
-0
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
c57f9f94
...
@@ -1401,8 +1401,9 @@ class FileFinder:
...
@@ -1401,8 +1401,9 @@ class FileFinder:
path
=
self
.
path
path
=
self
.
path
try
:
try
:
contents
=
_os
.
listdir
(
path
)
contents
=
_os
.
listdir
(
path
)
except
FileNotFoundError
:
except
(
FileNotFoundError
,
PermissionError
,
NotADirectoryError
):
# Directory has been removed since last import
# Directory has either been removed, turned into a file, or made
# unreadable.
contents
=
[]
contents
=
[]
# We store two cached versions, to handle runtime changes of the
# We store two cached versions, to handle runtime changes of the
# PYTHONCASEOK environment variable.
# PYTHONCASEOK environment variable.
...
...
Lib/test/test_importlib/source/test_finder.py
Dosyayı görüntüle @
c57f9f94
...
@@ -6,6 +6,9 @@ import errno
...
@@ -6,6 +6,9 @@ import errno
import
imp
import
imp
import
os
import
os
import
py_compile
import
py_compile
import
stat
import
sys
import
tempfile
from
test.support
import
make_legacy_pyc
from
test.support
import
make_legacy_pyc
import
unittest
import
unittest
import
warnings
import
warnings
...
@@ -147,6 +150,38 @@ class FinderTests(abc.FinderTests):
...
@@ -147,6 +150,38 @@ class FinderTests(abc.FinderTests):
self
.
assertIsNotNone
(
finder
.
find_module
(
mod
))
self
.
assertIsNotNone
(
finder
.
find_module
(
mod
))
self
.
assertIsNone
(
finder
.
find_module
(
mod
))
self
.
assertIsNone
(
finder
.
find_module
(
mod
))
@unittest.skipUnless
(
sys
.
platform
!=
'win32'
,
'os.chmod() does not support the needed arguments under Windows'
)
def
test_no_read_directory
(
self
):
# Issue #16730
tempdir
=
tempfile
.
TemporaryDirectory
()
original_mode
=
os
.
stat
(
tempdir
.
name
)
.
st_mode
def
cleanup
(
tempdir
):
"""Cleanup function for the temporary directory.
Since we muck with the permissions, we want to set them back to
their original values to make sure the directory can be properly
cleaned up.
"""
os
.
chmod
(
tempdir
.
name
,
original_mode
)
# If this is not explicitly called then the __del__ method is used,
# but since already mucking around might as well explicitly clean
# up.
tempdir
.
__exit__
(
None
,
None
,
None
)
self
.
addCleanup
(
cleanup
,
tempdir
)
os
.
chmod
(
tempdir
.
name
,
stat
.
S_IWUSR
|
stat
.
S_IXUSR
)
finder
=
self
.
get_finder
(
tempdir
.
name
)
self
.
assertEqual
((
None
,
[]),
finder
.
find_loader
(
'doesnotexist'
))
def
test_ignore_file
(
self
):
# If a directory got changed to a file from underneath us, then don't
# worry about looking for submodules.
with
tempfile
.
NamedTemporaryFile
()
as
file_obj
:
finder
=
self
.
get_finder
(
file_obj
.
name
)
self
.
assertEqual
((
None
,
[]),
finder
.
find_loader
(
'doesnotexist'
))
def
test_main
():
def
test_main
():
from
test.support
import
run_unittest
from
test.support
import
run_unittest
run_unittest
(
FinderTests
)
run_unittest
(
FinderTests
)
...
...
Misc/NEWS
Dosyayı görüntüle @
c57f9f94
...
@@ -10,6 +10,11 @@ What's New in Python 3.4.0 Alpha 1?
...
@@ -10,6 +10,11 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #16730: importlib.machinery.FileFinder now no longers raises an
exception when trying to populate its cache and it finds out the directory is
unreadable or has turned into a file. Reported and diagnosed by
David Pritchard.
- Issue #16906: Fix a logic error that prevented most static strings from being
- Issue #16906: Fix a logic error that prevented most static strings from being
cleared.
cleared.
...
...
Python/importlib.h
Dosyayı görüntüle @
c57f9f94
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