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
22d9ee7e
Kaydet (Commit)
22d9ee7e
authored
Ara 28, 2013
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
complain if the codec doesn't return unicode
üst
63cc99d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
0 deletions
+16
-0
bad_coding3.py
Lib/test/bad_coding3.py
+2
-0
test_pep263.py
Lib/test/test_pep263.py
+5
-0
NEWS
Misc/NEWS
+3
-0
tokenizer.c
Parser/tokenizer.c
+6
-0
No files found.
Lib/test/bad_coding3.py
0 → 100644
Dosyayı görüntüle @
22d9ee7e
# coding: string-escape
\
x70
\
x72
\
x69
\
x6e
\
x74
\
x20
\
x32
\
x2b
\
x32
\
x0a
Lib/test/test_pep263.py
Dosyayı görüntüle @
22d9ee7e
...
@@ -58,6 +58,11 @@ class PEP263Test(unittest.TestCase):
...
@@ -58,6 +58,11 @@ class PEP263Test(unittest.TestCase):
with
self
.
assertRaisesRegexp
(
SyntaxError
,
'BOM'
):
with
self
.
assertRaisesRegexp
(
SyntaxError
,
'BOM'
):
compile
(
'
\xef\xbb\xbf
# -*- coding: fake -*-
\n
'
,
'dummy'
,
'exec'
)
compile
(
'
\xef\xbb\xbf
# -*- coding: fake -*-
\n
'
,
'dummy'
,
'exec'
)
def
test_non_unicode_codec
(
self
):
with
self
.
assertRaisesRegexp
(
SyntaxError
,
'codec did not return a unicode'
):
from
test
import
bad_coding3
def
test_main
():
def
test_main
():
test_support
.
run_unittest
(
PEP263Test
)
test_support
.
run_unittest
(
PEP263Test
)
...
...
Misc/NEWS
Dosyayı görüntüle @
22d9ee7e
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.7?
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.7?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Raise a better error when non-unicode codecs are used for a file'
s
coding
cookie
.
-
Issue
#
17976
:
Fixed
potential
problem
with
file
.
write
()
not
detecting
IO
error
-
Issue
#
17976
:
Fixed
potential
problem
with
file
.
write
()
not
detecting
IO
error
by
inspecting
the
return
value
of
fwrite
().
Based
on
patches
by
Jaakko
Moisio
by
inspecting
the
return
value
of
fwrite
().
Based
on
patches
by
Jaakko
Moisio
and
Victor
Stinner
.
and
Victor
Stinner
.
...
...
Parser/tokenizer.c
Dosyayı görüntüle @
22d9ee7e
...
@@ -400,6 +400,12 @@ fp_readl(char *s, int size, struct tok_state *tok)
...
@@ -400,6 +400,12 @@ fp_readl(char *s, int size, struct tok_state *tok)
buf
=
PyObject_CallObject
(
tok
->
decoding_readline
,
NULL
);
buf
=
PyObject_CallObject
(
tok
->
decoding_readline
,
NULL
);
if
(
buf
==
NULL
)
if
(
buf
==
NULL
)
return
error_ret
(
tok
);
return
error_ret
(
tok
);
if
(
!
PyUnicode_Check
(
buf
))
{
Py_DECREF
(
buf
);
PyErr_SetString
(
PyExc_SyntaxError
,
"codec did not return a unicode object"
);
return
error_ret
(
tok
);
}
}
else
{
}
else
{
tok
->
decoding_buffer
=
NULL
;
tok
->
decoding_buffer
=
NULL
;
if
(
PyString_CheckExact
(
buf
))
if
(
PyString_CheckExact
(
buf
))
...
...
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