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
feb3b758
Kaydet (Commit)
feb3b758
authored
Tem 04, 2010
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9130: Validate ellipsis tokens in relative imports.
üst
3445b482
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
test_parser.py
Lib/test/test_parser.py
+6
-0
parsermodule.c
Modules/parsermodule.c
+6
-6
No files found.
Lib/test/test_parser.py
Dosyayı görüntüle @
feb3b758
...
...
@@ -192,8 +192,14 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
def
test_relative_imports
(
self
):
self
.
check_suite
(
"from . import name"
)
self
.
check_suite
(
"from .. import name"
)
# check all the way up to '....', since '...' is tokenized
# differently from '.' (it's an ellipsis token).
self
.
check_suite
(
"from ... import name"
)
self
.
check_suite
(
"from .... import name"
)
self
.
check_suite
(
"from .pkg import name"
)
self
.
check_suite
(
"from ..pkg import name"
)
self
.
check_suite
(
"from ...pkg import name"
)
self
.
check_suite
(
"from ....pkg import name"
)
def
test_pep263
(
self
):
self
.
check_suite
(
"# -*- coding: iso-8859-1 -*-
\n
"
...
...
Modules/parsermodule.c
Dosyayı görüntüle @
feb3b758
...
...
@@ -1754,17 +1754,17 @@ validate_import_name(node *tree)
&&
validate_dotted_as_names
(
CHILD
(
tree
,
1
)));
}
/* Helper function to count the number of leading dots in
/* Helper function to count the number of leading dots
(or ellipsis tokens)
in
* 'from ...module import name'
*/
static
int
count_from_dots
(
node
*
tree
)
{
int
i
;
for
(
i
=
1
;
i
<
NCH
(
tree
);
i
++
)
if
(
TYPE
(
CHILD
(
tree
,
i
))
!=
DOT
)
break
;
return
i
-
1
;
int
i
;
for
(
i
=
1
;
i
<
NCH
(
tree
);
i
++
)
if
(
TYPE
(
CHILD
(
tree
,
i
))
!=
DOT
&&
TYPE
(
CHILD
(
tree
,
i
))
!=
ELLIPSIS
)
break
;
return
i
-
1
;
}
/* import_from: ('from' ('.'* dotted_name | '.'+)
...
...
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