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
f93234bb
Kaydet (Commit)
f93234bb
authored
May 09, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
May 09, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30024: Circular imports involving absolute imports with binding (#1264)
a submodule to a name are now supported.
üst
dbdea629
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
2 deletions
+17
-2
3.7.rst
Doc/whatsnew/3.7.rst
+4
-0
__init__.py
Lib/test/test_import/__init__.py
+6
-0
binding.py
Lib/test/test_import/data/circular_imports/binding.py
+1
-0
binding2.py
Lib/test/test_import/data/circular_imports/binding2.py
+1
-0
NEWS
Misc/NEWS
+3
-0
compile.c
Python/compile.c
+2
-2
No files found.
Doc/whatsnew/3.7.rst
Dosyayı görüntüle @
f93234bb
...
...
@@ -85,6 +85,10 @@ Other Language Changes
* :exc:`ImportError` now displays module name and module ``__file__`` path when
``from ... import ...`` fails. (Contributed by Matthias Bussonnier in :issue:`29546`.)
* Circular imports involving absolute imports with binding a submodule to
a name are now supported.
(Contributed by Serhiy Storchaka in :issue:`30024`.)
New Modules
===========
...
...
Lib/test/test_import/__init__.py
Dosyayı görüntüle @
f93234bb
...
...
@@ -1168,6 +1168,12 @@ class CircularImportTests(unittest.TestCase):
from
test.test_import.data.circular_imports.subpkg
import
util
self
.
assertIs
(
util
.
util
,
rebinding
.
util
)
def
test_binding
(
self
):
try
:
import
test.test_import.data.circular_imports.binding
except
ImportError
:
self
.
fail
(
'circular import with binding a submodule to a name failed'
)
if
__name__
==
'__main__'
:
# Test needs to be a package, so we can do relative imports.
...
...
Lib/test/test_import/data/circular_imports/binding.py
0 → 100644
Dosyayı görüntüle @
f93234bb
import
test.test_import.data.circular_imports.binding2
as
binding2
Lib/test/test_import/data/circular_imports/binding2.py
0 → 100644
Dosyayı görüntüle @
f93234bb
import
test.test_import.data.circular_imports.binding
as
binding
Misc/NEWS
Dosyayı görüntüle @
f93234bb
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.7.0 alpha 1?
Core and Builtins
-----------------
- bpo-30024: Circular imports involving absolute imports with binding
a submodule to a name are now supported.
- bpo-12414: sys.getsizeof() on a code object now returns the sizes
which includes the code struct and sizes of objects which it references.
Patch by Dong-hee Na.
...
...
Python/compile.c
Dosyayı görüntüle @
f93234bb
...
...
@@ -2546,7 +2546,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
merely needs to bind the result to a name.
If there is a dot in name, we need to split it and emit a
LOAD_ATTR
for each name.
IMPORT_FROM
for each name.
*/
Py_ssize_t
dot
=
PyUnicode_FindChar
(
name
,
'.'
,
0
,
PyUnicode_GET_LENGTH
(
name
),
1
);
...
...
@@ -2566,7 +2566,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
PyUnicode_GET_LENGTH
(
name
));
if
(
!
attr
)
return
0
;
ADDOP_O
(
c
,
LOAD_ATTR
,
attr
,
names
);
ADDOP_O
(
c
,
IMPORT_FROM
,
attr
,
names
);
Py_DECREF
(
attr
);
pos
=
dot
+
1
;
}
...
...
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