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
946cfc3e
Kaydet (Commit)
946cfc3e
authored
May 14, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21075: fileinput.FileInput now reads bytes from standard stream if
binary mode is specified. Patch by Sam Kimbrel.
üst
e2d66903
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
fileinput.py
Lib/fileinput.py
+4
-1
test_fileinput.py
Lib/test/test_fileinput.py
+9
-1
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/fileinput.py
Dosyayı görüntüle @
946cfc3e
...
@@ -320,7 +320,10 @@ class FileInput:
...
@@ -320,7 +320,10 @@ class FileInput:
self
.
_backupfilename
=
0
self
.
_backupfilename
=
0
if
self
.
_filename
==
'-'
:
if
self
.
_filename
==
'-'
:
self
.
_filename
=
'<stdin>'
self
.
_filename
=
'<stdin>'
self
.
_file
=
sys
.
stdin
if
'b'
in
self
.
_mode
:
self
.
_file
=
sys
.
stdin
.
buffer
else
:
self
.
_file
=
sys
.
stdin
self
.
_isstdin
=
True
self
.
_isstdin
=
True
else
:
else
:
if
self
.
_inplace
:
if
self
.
_inplace
:
...
...
Lib/test/test_fileinput.py
Dosyayı görüntüle @
946cfc3e
...
@@ -19,11 +19,12 @@ try:
...
@@ -19,11 +19,12 @@ try:
except
ImportError
:
except
ImportError
:
gzip
=
None
gzip
=
None
from
io
import
StringIO
from
io
import
BytesIO
,
StringIO
from
fileinput
import
FileInput
,
hook_encoded
from
fileinput
import
FileInput
,
hook_encoded
from
test.support
import
verbose
,
TESTFN
,
run_unittest
,
check_warnings
from
test.support
import
verbose
,
TESTFN
,
run_unittest
,
check_warnings
from
test.support
import
unlink
as
safe_unlink
from
test.support
import
unlink
as
safe_unlink
from
unittest
import
mock
# The fileinput module has 2 interfaces: the FileInput class which does
# The fileinput module has 2 interfaces: the FileInput class which does
...
@@ -232,6 +233,13 @@ class FileInputTests(unittest.TestCase):
...
@@ -232,6 +233,13 @@ class FileInputTests(unittest.TestCase):
finally
:
finally
:
remove_tempfiles
(
t1
)
remove_tempfiles
(
t1
)
def
test_stdin_binary_mode
(
self
):
with
mock
.
patch
(
'sys.stdin'
)
as
m_stdin
:
m_stdin
.
buffer
=
BytesIO
(
b
'spam, bacon, sausage, and spam'
)
fi
=
FileInput
(
files
=
[
'-'
],
mode
=
'rb'
)
lines
=
list
(
fi
)
self
.
assertEqual
(
lines
,
[
b
'spam, bacon, sausage, and spam'
])
def
test_file_opening_hook
(
self
):
def
test_file_opening_hook
(
self
):
try
:
try
:
# cannot use openhook and inplace mode
# cannot use openhook and inplace mode
...
...
Misc/ACKS
Dosyayı görüntüle @
946cfc3e
...
@@ -674,6 +674,7 @@ Mads Kiilerich
...
@@ -674,6 +674,7 @@ Mads Kiilerich
Jason Killen
Jason Killen
Jan Kim
Jan Kim
Taek Joo Kim
Taek Joo Kim
Sam Kimbrel
W. Trevor King
W. Trevor King
Paul Kippes
Paul Kippes
Steve Kirsch
Steve Kirsch
...
...
Misc/NEWS
Dosyayı görüntüle @
946cfc3e
...
@@ -23,6 +23,9 @@ Core and Builtins
...
@@ -23,6 +23,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #21075: fileinput.FileInput now reads bytes from standard stream if
binary mode is specified. Patch by Sam Kimbrel.
- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a
- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a
flush() on the underlying binary stream. Patch by akira.
flush() on the underlying binary stream. Patch by akira.
...
...
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