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
bfc51567
Kaydet (Commit)
bfc51567
authored
Kas 22, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
backport r67325: make FileIO.mode always contain 'b'
üst
c078f929
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
+16
-12
test_fileio.py
Lib/test/test_fileio.py
+2
-2
test_io.py
Lib/test/test_io.py
+7
-7
NEWS
Misc/NEWS
+2
-0
_fileio.c
Modules/_fileio.c
+5
-3
No files found.
Lib/test/test_fileio.py
Dosyayı görüntüle @
bfc51567
...
@@ -50,7 +50,7 @@ class AutoFileTests(unittest.TestCase):
...
@@ -50,7 +50,7 @@ class AutoFileTests(unittest.TestCase):
# verify expected attributes exist
# verify expected attributes exist
f
=
self
.
f
f
=
self
.
f
self
.
assertEquals
(
f
.
mode
,
"w"
)
self
.
assertEquals
(
f
.
mode
,
"w
b
"
)
self
.
assertEquals
(
f
.
closed
,
False
)
self
.
assertEquals
(
f
.
closed
,
False
)
# verify the attributes are readonly
# verify the attributes are readonly
...
@@ -160,7 +160,7 @@ class OtherFileTests(unittest.TestCase):
...
@@ -160,7 +160,7 @@ class OtherFileTests(unittest.TestCase):
def
testModeStrings
(
self
):
def
testModeStrings
(
self
):
# check invalid mode strings
# check invalid mode strings
for
mode
in
(
""
,
"aU"
,
"wU+"
,
"r
b
"
,
"rt"
):
for
mode
in
(
""
,
"aU"
,
"wU+"
,
"r
w
"
,
"rt"
):
try
:
try
:
f
=
_fileio
.
_FileIO
(
TESTFN
,
mode
)
f
=
_fileio
.
_FileIO
(
TESTFN
,
mode
)
except
ValueError
:
except
ValueError
:
...
...
Lib/test/test_io.py
Dosyayı görüntüle @
bfc51567
...
@@ -1266,7 +1266,7 @@ class MiscIOTest(unittest.TestCase):
...
@@ -1266,7 +1266,7 @@ class MiscIOTest(unittest.TestCase):
def
test_attributes
(
self
):
def
test_attributes
(
self
):
f
=
io
.
open
(
test_support
.
TESTFN
,
"wb"
,
buffering
=
0
)
f
=
io
.
open
(
test_support
.
TESTFN
,
"wb"
,
buffering
=
0
)
self
.
assertEquals
(
f
.
mode
,
"w"
)
self
.
assertEquals
(
f
.
mode
,
"w
b
"
)
f
.
close
()
f
.
close
()
f
=
io
.
open
(
test_support
.
TESTFN
,
"U"
)
f
=
io
.
open
(
test_support
.
TESTFN
,
"U"
)
...
@@ -1274,18 +1274,18 @@ class MiscIOTest(unittest.TestCase):
...
@@ -1274,18 +1274,18 @@ class MiscIOTest(unittest.TestCase):
self
.
assertEquals
(
f
.
buffer
.
name
,
test_support
.
TESTFN
)
self
.
assertEquals
(
f
.
buffer
.
name
,
test_support
.
TESTFN
)
self
.
assertEquals
(
f
.
buffer
.
raw
.
name
,
test_support
.
TESTFN
)
self
.
assertEquals
(
f
.
buffer
.
raw
.
name
,
test_support
.
TESTFN
)
self
.
assertEquals
(
f
.
mode
,
"U"
)
self
.
assertEquals
(
f
.
mode
,
"U"
)
self
.
assertEquals
(
f
.
buffer
.
mode
,
"r"
)
self
.
assertEquals
(
f
.
buffer
.
mode
,
"r
b
"
)
self
.
assertEquals
(
f
.
buffer
.
raw
.
mode
,
"r"
)
self
.
assertEquals
(
f
.
buffer
.
raw
.
mode
,
"r
b
"
)
f
.
close
()
f
.
close
()
f
=
io
.
open
(
test_support
.
TESTFN
,
"w+"
)
f
=
io
.
open
(
test_support
.
TESTFN
,
"w+"
)
self
.
assertEquals
(
f
.
mode
,
"w+"
)
self
.
assertEquals
(
f
.
mode
,
"w+"
)
self
.
assertEquals
(
f
.
buffer
.
mode
,
"r+"
)
# Does it really matter?
self
.
assertEquals
(
f
.
buffer
.
mode
,
"r
b
+"
)
# Does it really matter?
self
.
assertEquals
(
f
.
buffer
.
raw
.
mode
,
"r+"
)
self
.
assertEquals
(
f
.
buffer
.
raw
.
mode
,
"r
b
+"
)
g
=
io
.
open
(
f
.
fileno
(),
"wb"
,
closefd
=
False
)
g
=
io
.
open
(
f
.
fileno
(),
"wb"
,
closefd
=
False
)
self
.
assertEquals
(
g
.
mode
,
"w"
)
self
.
assertEquals
(
g
.
mode
,
"w
b
"
)
self
.
assertEquals
(
g
.
raw
.
mode
,
"w"
)
self
.
assertEquals
(
g
.
raw
.
mode
,
"w
b
"
)
self
.
assertEquals
(
g
.
name
,
f
.
fileno
())
self
.
assertEquals
(
g
.
name
,
f
.
fileno
())
self
.
assertEquals
(
g
.
raw
.
name
,
f
.
fileno
())
self
.
assertEquals
(
g
.
raw
.
name
,
f
.
fileno
())
f
.
close
()
f
.
close
()
...
...
Misc/NEWS
Dosyayı görüntüle @
bfc51567
...
@@ -56,6 +56,8 @@ Library
...
@@ -56,6 +56,8 @@ Library
- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if
- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if
the ctypes module is not present.
the ctypes module is not present.
- FileIO's mode attribute now always includes ``"b"``.
- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__.
- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__.
- httplib.HTTPConnection.putheader() now accepts an arbitrary number of values
- httplib.HTTPConnection.putheader() now accepts an arbitrary number of values
...
...
Modules/_fileio.c
Dosyayı görüntüle @
bfc51567
...
@@ -208,6 +208,8 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
...
@@ -208,6 +208,8 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
flags
|=
O_CREAT
;
flags
|=
O_CREAT
;
append
=
1
;
append
=
1
;
break
;
break
;
case
'b'
:
break
;
case
'+'
:
case
'+'
:
if
(
plus
)
if
(
plus
)
goto
bad_mode
;
goto
bad_mode
;
...
@@ -682,12 +684,12 @@ mode_string(PyFileIOObject *self)
...
@@ -682,12 +684,12 @@ mode_string(PyFileIOObject *self)
{
{
if
(
self
->
readable
)
{
if
(
self
->
readable
)
{
if
(
self
->
writable
)
if
(
self
->
writable
)
return
"r+"
;
return
"r
b
+"
;
else
else
return
"r"
;
return
"r
b
"
;
}
}
else
else
return
"w"
;
return
"w
b
"
;
}
}
static
PyObject
*
static
PyObject
*
...
...
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