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
ef29f863
Kaydet (Commit)
ef29f863
authored
Ara 28, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backport r67975: #4759: fix segfault in bytearray.translate(x, None).
üst
828a7066
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
test_bytes.py
Lib/test/test_bytes.py
+8
-0
NEWS
Misc/NEWS
+2
-0
bytearrayobject.c
Objects/bytearrayobject.c
+1
-0
No files found.
Lib/test/test_bytes.py
Dosyayı görüntüle @
ef29f863
...
...
@@ -872,11 +872,19 @@ class AssortedBytesTest(unittest.TestCase):
def
test_translate
(
self
):
b
=
b
'hello'
ba
=
bytearray
(
b
)
rosetta
=
bytearray
(
range
(
0
,
256
))
rosetta
[
ord
(
'o'
)]
=
ord
(
'e'
)
c
=
b
.
translate
(
rosetta
,
b
'l'
)
self
.
assertEqual
(
b
,
b
'hello'
)
self
.
assertEqual
(
c
,
b
'hee'
)
c
=
ba
.
translate
(
rosetta
,
b
'l'
)
self
.
assertEqual
(
ba
,
b
'hello'
)
self
.
assertEqual
(
c
,
b
'hee'
)
c
=
b
.
translate
(
None
,
b
'e'
)
self
.
assertEqual
(
c
,
b
'hllo'
)
self
.
assertRaises
(
TypeError
,
b
.
translate
,
b
'a'
*
256
,
None
)
self
.
assertRaises
(
TypeError
,
ba
.
translate
,
b
'a'
*
256
,
None
)
def
test_split_bytearray
(
self
):
self
.
assertEqual
(
b
'a b'
.
split
(
memoryview
(
b
' '
)),
[
b
'a'
,
b
'b'
])
...
...
Misc/NEWS
Dosyayı görüntüle @
ef29f863
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.6.2
Core and Builtins
-----------------
- Issue #4759: fix a segfault for bytearray.translate(x, None).
- Added test case to ensure attempts to read from a file opened for writing
fail.
...
...
Objects/bytearrayobject.c
Dosyayı görüntüle @
ef29f863
...
...
@@ -1465,6 +1465,7 @@ bytes_translate(PyByteArrayObject *self, PyObject *args)
if
(
delobj
!=
NULL
)
{
if
(
_getbuffer
(
delobj
,
&
vdel
)
<
0
)
{
result
=
NULL
;
delobj
=
NULL
;
/* don't try to release vdel buffer on exit */
goto
done
;
}
}
...
...
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