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
01759d55
Kaydet (Commit)
01759d55
authored
Ock 02, 2016
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge: #22709: Use stdin as-is if it does not have a buffer attribute.
üst
5b3455c7
830207e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
fileinput.py
Lib/fileinput.py
+1
-1
test_fileinput.py
Lib/test/test_fileinput.py
+11
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/fileinput.py
Dosyayı görüntüle @
01759d55
...
@@ -328,7 +328,7 @@ class FileInput:
...
@@ -328,7 +328,7 @@ class FileInput:
if
self
.
_filename
==
'-'
:
if
self
.
_filename
==
'-'
:
self
.
_filename
=
'<stdin>'
self
.
_filename
=
'<stdin>'
if
'b'
in
self
.
_mode
:
if
'b'
in
self
.
_mode
:
self
.
_file
=
sys
.
stdin
.
buffer
self
.
_file
=
getattr
(
sys
.
stdin
,
'buffer'
,
sys
.
stdin
)
else
:
else
:
self
.
_file
=
sys
.
stdin
self
.
_file
=
sys
.
stdin
self
.
_isstdin
=
True
self
.
_isstdin
=
True
...
...
Lib/test/test_fileinput.py
Dosyayı görüntüle @
01759d55
...
@@ -240,6 +240,17 @@ class FileInputTests(unittest.TestCase):
...
@@ -240,6 +240,17 @@ class FileInputTests(unittest.TestCase):
lines
=
list
(
fi
)
lines
=
list
(
fi
)
self
.
assertEqual
(
lines
,
[
b
'spam, bacon, sausage, and spam'
])
self
.
assertEqual
(
lines
,
[
b
'spam, bacon, sausage, and spam'
])
def
test_detached_stdin_binary_mode
(
self
):
orig_stdin
=
sys
.
stdin
try
:
sys
.
stdin
=
BytesIO
(
b
'spam, bacon, sausage, and spam'
)
self
.
assertFalse
(
hasattr
(
sys
.
stdin
,
'buffer'
))
fi
=
FileInput
(
files
=
[
'-'
],
mode
=
'rb'
)
lines
=
list
(
fi
)
self
.
assertEqual
(
lines
,
[
b
'spam, bacon, sausage, and spam'
])
finally
:
sys
.
stdin
=
orig_stdin
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/NEWS
Dosyayı görüntüle @
01759d55
...
@@ -128,6 +128,9 @@ Core and Builtins
...
@@ -128,6 +128,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #25447: fileinput now uses sys.stdin as-is if it does not have a
buffer attribute (restores backward compatibility).
- Issue #25971: Optimized creating Fractions from floats by 2 times and from
- Issue #25971: Optimized creating Fractions from floats by 2 times and from
Decimals by 3 times.
Decimals by 3 times.
...
...
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