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
a4d77898
Kaydet (Commit)
a4d77898
authored
Mar 19, 2008
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #2400: Allow relative imports to "import *".
üst
de48d840
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
5 deletions
+16
-5
relimport.py
Lib/test/relimport.py
+1
-0
test_import.py
Lib/test/test_import.py
+13
-1
NEWS
Misc/NEWS
+2
-0
ast.c
Python/ast.c
+0
-4
No files found.
Lib/test/relimport.py
0 → 100644
Dosyayı görüntüle @
a4d77898
from
.test_import
import
*
Lib/test/test_import.py
Dosyayı görüntüle @
a4d77898
...
...
@@ -254,8 +254,20 @@ class PathsTests(unittest.TestCase):
self
.
assertEqual
(
mod
.
testdata
,
'test_trailing_slash'
)
unload
(
"test_trailing_slash"
)
class
RelativeImport
(
unittest
.
TestCase
):
def
tearDown
(
self
):
try
:
del
sys
.
modules
[
"test.relimport"
]
except
:
pass
def
test_relimport_star
(
self
):
# This will import * from .test_import.
import
relimport
self
.
assertTrue
(
hasattr
(
relimport
,
"RelativeImport"
))
def
test_main
(
verbose
=
None
):
run_unittest
(
ImportTest
,
PathsTests
)
run_unittest
(
ImportTest
,
PathsTests
,
RelativeImport
)
if
__name__
==
'__main__'
:
test_main
()
Misc/NEWS
Dosyayı görüntüle @
a4d77898
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.6 alpha 2?
Core and builtins
-----------------
- Issue #2400: Allow relative imports to "import *".
- Issue 1745. Backport print function with:
from __future__ import print_function
...
...
Python/ast.c
Dosyayı görüntüle @
a4d77898
...
...
@@ -2413,10 +2413,6 @@ ast_for_import_stmt(struct compiling *c, const node *n)
/* from ... import * */
n
=
CHILD
(
n
,
idx
);
n_children
=
1
;
if
(
ndots
)
{
ast_error
(
n
,
"'import *' not allowed with 'from .'"
);
return
NULL
;
}
break
;
case
LPAR
:
/* from ... import (x, y, z) */
...
...
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