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
b0acc1b0
Kaydet (Commit)
b0acc1b0
authored
May 08, 2014
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21350: Fix file.writelines() to accept arbitrary buffer objects, as advertised.
Patch by Brian Kearns.
üst
9ba90c9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
test_file2k.py
Lib/test/test_file2k.py
+7
-0
NEWS
Misc/NEWS
+3
-0
fileobject.c
Objects/fileobject.c
+7
-7
No files found.
Lib/test/test_file2k.py
Dosyayı görüntüle @
b0acc1b0
...
@@ -89,6 +89,13 @@ class AutoFileTests(unittest.TestCase):
...
@@ -89,6 +89,13 @@ class AutoFileTests(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
self
.
f
.
writelines
,
self
.
assertRaises
(
TypeError
,
self
.
f
.
writelines
,
[
NonString
(),
NonString
()])
[
NonString
(),
NonString
()])
def
testWritelinesBuffer
(
self
):
self
.
f
.
writelines
([
array
(
'c'
,
'abc'
)])
self
.
f
.
close
()
self
.
f
=
open
(
TESTFN
,
'rb'
)
buf
=
self
.
f
.
read
()
self
.
assertEqual
(
buf
,
'abc'
)
def
testRepr
(
self
):
def
testRepr
(
self
):
# verify repr works
# verify repr works
self
.
assertTrue
(
repr
(
self
.
f
)
.
startswith
(
"<open file '"
+
TESTFN
))
self
.
assertTrue
(
repr
(
self
.
f
)
.
startswith
(
"<open file '"
+
TESTFN
))
...
...
Misc/NEWS
Dosyayı görüntüle @
b0acc1b0
...
@@ -10,6 +10,9 @@ What's New in Python 2.7.7?
...
@@ -10,6 +10,9 @@ What's New in Python 2.7.7?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #21350: Fix file.writelines() to accept arbitrary buffer objects,
as advertised. Patch by Brian Kearns.
- Issue #20437: Fixed 43 potential bugs when deleting objects references.
- Issue #20437: Fixed 43 potential bugs when deleting objects references.
- Issue #21134: Fix segfault when str is called on an uninitialized
- Issue #21134: Fix segfault when str is called on an uninitialized
...
...
Objects/fileobject.c
Dosyayı görüntüle @
b0acc1b0
...
@@ -1941,13 +1941,13 @@ file_writelines(PyFileObject *f, PyObject *seq)
...
@@ -1941,13 +1941,13 @@ file_writelines(PyFileObject *f, PyObject *seq)
PyObject
*
v
=
PyList_GET_ITEM
(
list
,
i
);
PyObject
*
v
=
PyList_GET_ITEM
(
list
,
i
);
if
(
!
PyString_Check
(
v
))
{
if
(
!
PyString_Check
(
v
))
{
const
char
*
buffer
;
const
char
*
buffer
;
i
f
(((
f
->
f_binary
&&
i
nt
res
;
PyObject_AsReadBuffer
(
v
,
if
(
f
->
f_binary
)
{
(
const
void
**
)
&
buffer
,
res
=
PyObject_AsReadBuffer
(
v
,
(
const
void
**
)
&
buffer
,
&
len
);
&
len
))
||
}
else
{
PyObject_AsCharBuffer
(
v
,
res
=
PyObject_AsCharBuffer
(
v
,
&
buffer
,
&
len
);
&
buffer
,
}
&
len
))
)
{
if
(
res
)
{
PyErr_SetString
(
PyExc_TypeError
,
PyErr_SetString
(
PyExc_TypeError
,
"writelines() argument must be a sequence of strings"
);
"writelines() argument must be a sequence of strings"
);
goto
error
;
goto
error
;
...
...
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