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
1fac5a45
Kaydet (Commit)
1fac5a45
authored
Eki 30, 2008
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed a modulefinder crash on certain relative imports.
üst
9f616f48
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
modulefinder.py
Lib/modulefinder.py
+4
-1
test_modulefinder.py
Lib/test/test_modulefinder.py
+16
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/modulefinder.py
Dosyayı görüntüle @
1fac5a45
...
...
@@ -309,7 +309,10 @@ class ModuleFinder:
def
_add_badmodule
(
self
,
name
,
caller
):
if
name
not
in
self
.
badmodules
:
self
.
badmodules
[
name
]
=
{}
self
.
badmodules
[
name
][
caller
.
__name__
]
=
1
if
caller
:
self
.
badmodules
[
name
][
caller
.
__name__
]
=
1
else
:
self
.
badmodules
[
name
][
"-"
]
=
1
def
_safe_import_hook
(
self
,
name
,
caller
,
fromlist
,
level
=-
1
):
# wrapper for self.import_hook() that won't raise ImportError
...
...
Lib/test/test_modulefinder.py
Dosyayı görüntüle @
1fac5a45
...
...
@@ -190,6 +190,19 @@ a/b/c/e.py
a/b/c/f.py
"""
]
relative_import_test_3
=
[
"a.module"
,
[
"a"
,
"a.module"
],
[
"a.bar"
],
[],
"""
\
a/__init__.py
def foo(): pass
a/module.py
from . import foo
from . import bar
"""
]
def
open_file
(
path
):
##print "#", os.path.abspath(path)
dirname
=
os
.
path
.
dirname
(
path
)
...
...
@@ -256,6 +269,9 @@ class ModuleFinderTest(unittest.TestCase):
def
test_relative_imports_2
(
self
):
self
.
_do_test
(
relative_import_test_2
)
def
test_relative_imports_3
(
self
):
self
.
_do_test
(
relative_import_test_3
)
def
test_main
():
distutils
.
log
.
set_threshold
(
distutils
.
log
.
WARN
)
test_support
.
run_unittest
(
ModuleFinderTest
)
...
...
Misc/NEWS
Dosyayı görüntüle @
1fac5a45
...
...
@@ -30,6 +30,8 @@ Core and Builtins
Library
-------
- Fixed a modulefinder crash on certain relative imports.
- Issue #4150: Pdb's "up" command now works for generator frames in post-mortem
debugging.
...
...
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