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
7b4bcd20
Kaydet (Commit)
7b4bcd20
authored
Eyl 16, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #25270: Merge from 3.5
üst
de3f48ae
4a72a7b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
6 deletions
+38
-6
bytes.rst
Doc/c-api/bytes.rst
+1
-1
test_codecs.py
Lib/test/test_codecs.py
+20
-0
NEWS
Misc/NEWS
+3
-0
bytesobject.c
Objects/bytesobject.c
+14
-5
No files found.
Doc/c-api/bytes.rst
Dosyayı görüntüle @
7b4bcd20
...
...
@@ -198,5 +198,5 @@ called with a non-bytes parameter.
desired. On success, *\*bytes* holds the resized bytes object and ``0`` is
returned; the address in *\*bytes* may differ from its input value. If the
reallocation fails, the original bytes object at *\*bytes* is deallocated,
*\*bytes* is set to *NULL*,
a memory exception
is set, and ``-1`` is
*\*bytes* is set to *NULL*,
:exc:`MemoryError`
is set, and ``-1`` is
returned.
Lib/test/test_codecs.py
Dosyayı görüntüle @
7b4bcd20
...
...
@@ -2542,6 +2542,26 @@ class RawUnicodeEscapeTest(unittest.TestCase):
self
.
assertEqual
(
decode
(
br
"
\U00110000
"
,
"replace"
),
(
"
\ufffd
"
,
10
))
class
EscapeEncodeTest
(
unittest
.
TestCase
):
def
test_escape_encode
(
self
):
tests
=
[
(
b
''
,
(
b
''
,
0
)),
(
b
'foobar'
,
(
b
'foobar'
,
6
)),
(
b
'spam
\0
eggs'
,
(
b
'spam
\\
x00eggs'
,
9
)),
(
b
'a
\'
b'
,
(
b
"a
\\
'b"
,
3
)),
(
b
'b
\\
c'
,
(
b
'b
\\\\
c'
,
3
)),
(
b
'c
\n
d'
,
(
b
'c
\\
nd'
,
3
)),
(
b
'd
\r
e'
,
(
b
'd
\\
re'
,
3
)),
(
b
'f
\x7f
g'
,
(
b
'f
\\
x7fg'
,
3
)),
]
for
data
,
output
in
tests
:
with
self
.
subTest
(
data
=
data
):
self
.
assertEqual
(
codecs
.
escape_encode
(
data
),
output
)
self
.
assertRaises
(
TypeError
,
codecs
.
escape_encode
,
'spam'
)
self
.
assertRaises
(
TypeError
,
codecs
.
escape_encode
,
bytearray
(
b
'spam'
))
class
SurrogateEscapeTest
(
unittest
.
TestCase
):
def
test_utf8
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
7b4bcd20
...
...
@@ -27,6 +27,9 @@ Core and Builtins
Library
-------
-
Issue
#
25270
:
Prevent
codecs
.
escape_encode
()
from
raising
SystemError
when
an
empty
bytestring
is
passed
.
-
Issue
#
28181
:
Get
antigravity
over
HTTPS
.
Patch
by
Kaartic
Sivaraam
.
-
Issue
#
25895
:
Enable
WebSocket
URL
schemes
in
urllib
.
parse
.
urljoin
.
...
...
Objects/bytesobject.c
Dosyayı görüntüle @
7b4bcd20
...
...
@@ -2910,11 +2910,15 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize)
PyObject
*
v
;
PyBytesObject
*
sv
;
v
=
*
pv
;
if
(
!
PyBytes_Check
(
v
)
||
Py_REFCNT
(
v
)
!=
1
||
newsize
<
0
)
{
*
pv
=
0
;
Py_DECREF
(
v
);
PyErr_BadInternalCall
();
return
-
1
;
if
(
!
PyBytes_Check
(
v
)
||
newsize
<
0
)
{
goto
error
;
}
if
(
Py_SIZE
(
v
)
==
newsize
)
{
/* return early if newsize equals to v->ob_size */
return
0
;
}
if
(
Py_REFCNT
(
v
)
!=
1
)
{
goto
error
;
}
/* XXX UNREF/NEWREF interface should be more symmetrical */
_Py_DEC_REFTOTAL
;
...
...
@@ -2932,6 +2936,11 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize)
sv
->
ob_sval
[
newsize
]
=
'\0'
;
sv
->
ob_shash
=
-
1
;
/* invalidate cached hash value */
return
0
;
error:
*
pv
=
0
;
Py_DECREF
(
v
);
PyErr_BadInternalCall
();
return
-
1
;
}
void
...
...
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