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
71fd224a
Kaydet (Commit)
71fd224a
authored
Nis 10, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21859: Added Python implementation of io.FileIO.
üst
cd092efb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
8 deletions
+34
-8
_pyio.py
Lib/_pyio.py
+0
-0
test_file_eintr.py
Lib/test/test_file_eintr.py
+32
-8
test_fileio.py
Lib/test/test_fileio.py
+0
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/_pyio.py
Dosyayı görüntüle @
71fd224a
This diff is collapsed.
Click to expand it.
Lib/test/test_file_eintr.py
Dosyayı görüntüle @
71fd224a
...
@@ -18,11 +18,12 @@ import time
...
@@ -18,11 +18,12 @@ import time
import
unittest
import
unittest
# Test import all of the things we're about to try testing up front.
# Test import all of the things we're about to try testing up front.
from
_io
import
FileIO
import
_io
import
_pyio
@unittest.skipUnless
(
os
.
name
==
'posix'
,
'tests requires a posix system.'
)
@unittest.skipUnless
(
os
.
name
==
'posix'
,
'tests requires a posix system.'
)
class
TestFileIOSignalInterrupt
(
unittest
.
TestCase
)
:
class
TestFileIOSignalInterrupt
:
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_process
=
None
self
.
_process
=
None
...
@@ -38,8 +39,9 @@ class TestFileIOSignalInterrupt(unittest.TestCase):
...
@@ -38,8 +39,9 @@ class TestFileIOSignalInterrupt(unittest.TestCase):
subclasseses should override this to test different IO objects.
subclasseses should override this to test different IO objects.
"""
"""
return
(
'import _io ;'
return
(
'import
%
s as io ;'
'infile = _io.FileIO(sys.stdin.fileno(), "rb")'
)
'infile = io.FileIO(sys.stdin.fileno(), "rb")'
%
self
.
modname
)
def
fail_with_process_info
(
self
,
why
,
stdout
=
b
''
,
stderr
=
b
''
,
def
fail_with_process_info
(
self
,
why
,
stdout
=
b
''
,
stderr
=
b
''
,
communicate
=
True
):
communicate
=
True
):
...
@@ -179,11 +181,19 @@ class TestFileIOSignalInterrupt(unittest.TestCase):
...
@@ -179,11 +181,19 @@ class TestFileIOSignalInterrupt(unittest.TestCase):
expected
=
b
'hello
\n
world!
\n
'
))
expected
=
b
'hello
\n
world!
\n
'
))
class
CTestFileIOSignalInterrupt
(
TestFileIOSignalInterrupt
,
unittest
.
TestCase
):
modname
=
'_io'
class
PyTestFileIOSignalInterrupt
(
TestFileIOSignalInterrupt
,
unittest
.
TestCase
):
modname
=
'_pyio'
class
TestBufferedIOSignalInterrupt
(
TestFileIOSignalInterrupt
):
class
TestBufferedIOSignalInterrupt
(
TestFileIOSignalInterrupt
):
def
_generate_infile_setup_code
(
self
):
def
_generate_infile_setup_code
(
self
):
"""Returns the infile = ... line of code to make a BufferedReader."""
"""Returns the infile = ... line of code to make a BufferedReader."""
return
(
'infile = open(sys.stdin.fileno(), "rb") ;'
return
(
'import
%
s as io ;infile = io.open(sys.stdin.fileno(), "rb") ;'
'import _io ;assert isinstance(infile, _io.BufferedReader)'
)
'assert isinstance(infile, io.BufferedReader)'
%
self
.
modname
)
def
test_readall
(
self
):
def
test_readall
(
self
):
"""BufferedReader.read() must handle signals and not lose data."""
"""BufferedReader.read() must handle signals and not lose data."""
...
@@ -193,12 +203,20 @@ class TestBufferedIOSignalInterrupt(TestFileIOSignalInterrupt):
...
@@ -193,12 +203,20 @@ class TestBufferedIOSignalInterrupt(TestFileIOSignalInterrupt):
read_method_name
=
'read'
,
read_method_name
=
'read'
,
expected
=
b
'hello
\n
world!
\n
'
))
expected
=
b
'hello
\n
world!
\n
'
))
class
CTestBufferedIOSignalInterrupt
(
TestBufferedIOSignalInterrupt
,
unittest
.
TestCase
):
modname
=
'_io'
class
PyTestBufferedIOSignalInterrupt
(
TestBufferedIOSignalInterrupt
,
unittest
.
TestCase
):
modname
=
'_pyio'
class
TestTextIOSignalInterrupt
(
TestFileIOSignalInterrupt
):
class
TestTextIOSignalInterrupt
(
TestFileIOSignalInterrupt
):
def
_generate_infile_setup_code
(
self
):
def
_generate_infile_setup_code
(
self
):
"""Returns the infile = ... line of code to make a TextIOWrapper."""
"""Returns the infile = ... line of code to make a TextIOWrapper."""
return
(
'infile = open(sys.stdin.fileno(), "rt", newline=None) ;'
return
(
'import
%
s as io ;'
'import _io ;assert isinstance(infile, _io.TextIOWrapper)'
)
'infile = io.open(sys.stdin.fileno(), "rt", newline=None) ;'
'assert isinstance(infile, io.TextIOWrapper)'
%
self
.
modname
)
def
test_readline
(
self
):
def
test_readline
(
self
):
"""readline() must handle signals and not lose data."""
"""readline() must handle signals and not lose data."""
...
@@ -224,6 +242,12 @@ class TestTextIOSignalInterrupt(TestFileIOSignalInterrupt):
...
@@ -224,6 +242,12 @@ class TestTextIOSignalInterrupt(TestFileIOSignalInterrupt):
read_method_name
=
'read'
,
read_method_name
=
'read'
,
expected
=
"hello
\n
world!
\n
"
))
expected
=
"hello
\n
world!
\n
"
))
class
CTestTextIOSignalInterrupt
(
TestTextIOSignalInterrupt
,
unittest
.
TestCase
):
modname
=
'_io'
class
PyTestTextIOSignalInterrupt
(
TestTextIOSignalInterrupt
,
unittest
.
TestCase
):
modname
=
'_pyio'
def
test_main
():
def
test_main
():
test_cases
=
[
test_cases
=
[
...
...
Lib/test/test_fileio.py
Dosyayı görüntüle @
71fd224a
This diff is collapsed.
Click to expand it.
Misc/NEWS
Dosyayı görüntüle @
71fd224a
...
@@ -19,6 +19,8 @@ Core and Builtins
...
@@ -19,6 +19,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #21859: Added Python implementation of io.FileIO.
- Issue #23865: close() methods in multiple modules now are idempotent and more
- Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
even if errors are occured.
...
...
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