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
758888d4
Kaydet (Commit)
758888d4
authored
May 30, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
don't restrict unexpected EOF errors to the first line (closes #12216)
üst
c8507bfe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
test_grammar.py
Lib/test/test_grammar.py
+7
-0
NEWS
Misc/NEWS
+2
-0
parsetok.c
Parser/parsetok.c
+1
-1
No files found.
Lib/test/test_grammar.py
Dosyayı görüntüle @
758888d4
...
...
@@ -125,6 +125,13 @@ the \'lazy\' dog.\n\
self
.
assertTrue
(
x
is
Ellipsis
)
self
.
assertRaises
(
SyntaxError
,
eval
,
".. ."
)
def
test_eof_error
(
self
):
samples
=
(
"def foo("
,
"
\n
def foo("
,
"def foo(
\n
"
)
for
s
in
samples
:
with
self
.
assertRaises
(
SyntaxError
)
as
cm
:
compile
(
s
,
"<test>"
,
"exec"
)
self
.
assertIn
(
"unexpected EOF"
,
str
(
cm
.
exception
))
class
GrammarTests
(
unittest
.
TestCase
):
# single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
...
...
Misc/NEWS
Dosyayı görüntüle @
758888d4
...
...
@@ -10,6 +10,8 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
-----------------
- Issue #12216: Allow unexpected EOF errors to happen on any line of the file.
- Issue #12199: The TryExcept and TryFinally and AST nodes have been unified
into a Try node.
...
...
Parser/parsetok.c
Dosyayı görüntüle @
758888d4
...
...
@@ -232,7 +232,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
PyParser_Delete
(
ps
);
if
(
n
==
NULL
)
{
if
(
tok
->
lineno
<=
1
&&
tok
->
done
==
E_EOF
)
if
(
tok
->
done
==
E_EOF
)
err_ret
->
error
=
E_EOF
;
err_ret
->
lineno
=
tok
->
lineno
;
if
(
tok
->
buf
!=
NULL
)
{
...
...
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