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
0911c0d2
Kaydet (Commit)
0911c0d2
authored
Şub 20, 2016
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge for issue #26367
üst
d9dc5302
4f38cb41
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
1 deletion
+12
-1
_bootstrap.py
Lib/importlib/_bootstrap.py
+4
-1
test_relative_imports.py
Lib/test/test_importlib/import_/test_relative_imports.py
+5
-0
NEWS
Misc/NEWS
+3
-0
importlib.h
Python/importlib.h
+0
-0
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
0911c0d2
...
@@ -922,9 +922,12 @@ def _sanity_check(name, package, level):
...
@@ -922,9 +922,12 @@ def _sanity_check(name, package, level):
raise
TypeError
(
'module name must be str, not {}'
.
format
(
type
(
name
)))
raise
TypeError
(
'module name must be str, not {}'
.
format
(
type
(
name
)))
if
level
<
0
:
if
level
<
0
:
raise
ValueError
(
'level must be >= 0'
)
raise
ValueError
(
'level must be >= 0'
)
if
package
:
if
level
>
0
:
if
not
isinstance
(
package
,
str
):
if
not
isinstance
(
package
,
str
):
raise
TypeError
(
'__package__ not set to a string'
)
raise
TypeError
(
'__package__ not set to a string'
)
elif
not
package
:
raise
ImportError
(
'attempted relative import with no known parent '
'package'
)
elif
package
not
in
sys
.
modules
:
elif
package
not
in
sys
.
modules
:
msg
=
(
'Parent module {!r} not loaded, cannot perform relative '
msg
=
(
'Parent module {!r} not loaded, cannot perform relative '
'import'
)
'import'
)
...
...
Lib/test/test_importlib/import_/test_relative_imports.py
Dosyayı görüntüle @
0911c0d2
...
@@ -218,6 +218,11 @@ class RelativeImports:
...
@@ -218,6 +218,11 @@ class RelativeImports:
self
.
__import__
(
'a'
,
{
'__package__'
:
''
,
'__spec__'
:
None
},
self
.
__import__
(
'a'
,
{
'__package__'
:
''
,
'__spec__'
:
None
},
level
=
1
)
level
=
1
)
def
test_relative_import_no_package_exists_absolute
(
self
):
with
self
.
assertRaises
(
ImportError
):
self
.
__import__
(
'sys'
,
{
'__package__'
:
''
,
'__spec__'
:
None
},
level
=
1
)
(
Frozen_RelativeImports
,
(
Frozen_RelativeImports
,
Source_RelativeImports
Source_RelativeImports
...
...
Misc/NEWS
Dosyayı görüntüle @
0911c0d2
...
@@ -185,6 +185,9 @@ Core and Builtins
...
@@ -185,6 +185,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
26367
:
importlib
.
__init__
()
raises
ImportError
like
builtins
.
__import__
()
when
``
level
``
is
specified
but
without
an
accompanying
package
specified
.
-
Issue
#
26309
:
In
the
"socketserver"
module
,
shut
down
the
request
(
closing
-
Issue
#
26309
:
In
the
"socketserver"
module
,
shut
down
the
request
(
closing
the
connected
socket
)
when
verify_request
()
returns
false
.
Patch
by
Aviv
the
connected
socket
)
when
verify_request
()
returns
false
.
Patch
by
Aviv
...
...
Python/importlib.h
Dosyayı görüntüle @
0911c0d2
This diff is collapsed.
Click to expand it.
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