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
794652dd
Kaydet (Commit)
794652dd
authored
Haz 11, 2008
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 2918: Merge StringIO and cStringIO.
üst
502d89ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
12 deletions
+45
-12
io.py
Lib/io.py
+0
-0
test_memoryio.py
Lib/test/test_memoryio.py
+7
-3
test_minidom.py
Lib/test/test_minidom.py
+1
-2
test_uu.py
Lib/test/test_uu.py
+30
-4
minidom.py
Lib/xml/dom/minidom.py
+4
-3
NEWS
Misc/NEWS
+2
-0
_stringio.c
Modules/_stringio.c
+0
-0
setup.py
setup.py
+1
-0
No files found.
Lib/io.py
Dosyayı görüntüle @
794652dd
This diff is collapsed.
Click to expand it.
Lib/test/test_memoryio.py
Dosyayı görüntüle @
794652dd
...
...
@@ -10,7 +10,7 @@ import io
import
sys
try
:
import
_bytesio
import
_bytesio
,
_stringio
has_c_implementation
=
True
except
ImportError
:
has_c_implementation
=
False
...
...
@@ -373,7 +373,7 @@ class PyBytesIOTest(MemoryTestMixin, unittest.TestCase):
class
PyStringIOTest
(
MemoryTestMixin
,
unittest
.
TestCase
):
buftype
=
str
ioclass
=
io
.
StringIO
ioclass
=
io
.
_
StringIO
EOF
=
""
def
test_relative_seek
(
self
):
...
...
@@ -404,10 +404,14 @@ if has_c_implementation:
class
CBytesIOTest
(
PyBytesIOTest
):
ioclass
=
io
.
BytesIO
class
CStringIOTest
(
PyStringIOTest
):
ioclass
=
io
.
StringIO
def
test_main
():
tests
=
[
PyBytesIOTest
,
PyStringIOTest
]
if
has_c_implementation
:
tests
.
extend
([
CBytesIOTest
])
tests
.
extend
([
CBytesIOTest
,
CStringIOTest
])
support
.
run_unittest
(
*
tests
)
if
__name__
==
'__main__'
:
...
...
Lib/test/test_minidom.py
Dosyayı görüntüle @
794652dd
...
...
@@ -3,7 +3,6 @@
import
os
import
sys
import
pickle
from
io
import
StringIO
from
test.support
import
verbose
,
run_unittest
,
TestSkipped
import
unittest
...
...
@@ -80,7 +79,7 @@ class MinidomTest(unittest.TestCase):
self
.
confirm
(
t
==
s
,
"looking for
%
s, found
%
s"
%
(
repr
(
s
),
repr
(
t
)))
def
testParseFromFile
(
self
):
dom
=
parse
(
StringIO
(
open
(
tstfile
)
.
read
()
))
dom
=
parse
(
open
(
tstfile
))
dom
.
unlink
()
self
.
confirm
(
isinstance
(
dom
,
Document
))
...
...
Lib/test/test_uu.py
Dosyayı görüntüle @
794652dd
...
...
@@ -17,6 +17,32 @@ encodedtext = b"""\
M5&AE('-M;V]T:
\"
US8V
%
L960@<'ET:&]N(&-R97!T(&]V97(@=&AE('-L965P
(:6YG(&1O9PH """
# Stolen from io.py
class
FakeIO
(
io
.
TextIOWrapper
):
"""Text I/O implementation using an in-memory buffer.
Can be a used as a drop-in replacement for sys.stdin and sys.stdout.
"""
# XXX This is really slow, but fully functional
def
__init__
(
self
,
initial_value
=
""
,
encoding
=
"utf-8"
,
errors
=
"strict"
,
newline
=
"
\n
"
):
super
(
FakeIO
,
self
)
.
__init__
(
io
.
BytesIO
(),
encoding
=
encoding
,
errors
=
errors
,
newline
=
newline
)
if
initial_value
:
if
not
isinstance
(
initial_value
,
str
):
initial_value
=
str
(
initial_value
)
self
.
write
(
initial_value
)
self
.
seek
(
0
)
def
getvalue
(
self
):
self
.
flush
()
return
self
.
buffer
.
getvalue
()
.
decode
(
self
.
_encoding
,
self
.
_errors
)
def
encodedtextwrapped
(
mode
,
filename
):
return
(
bytes
(
"begin
%03
o
%
s
\n
"
%
(
mode
,
filename
),
"ascii"
)
+
encodedtext
+
b
"
\n
\n
end
\n
"
)
...
...
@@ -76,15 +102,15 @@ class UUStdIOTest(unittest.TestCase):
sys
.
stdout
=
self
.
stdout
def
test_encode
(
self
):
sys
.
stdin
=
io
.
String
IO
(
plaintext
.
decode
(
"ascii"
))
sys
.
stdout
=
io
.
String
IO
()
sys
.
stdin
=
Fake
IO
(
plaintext
.
decode
(
"ascii"
))
sys
.
stdout
=
Fake
IO
()
uu
.
encode
(
"-"
,
"-"
,
"t1"
,
0
o666
)
self
.
assertEqual
(
sys
.
stdout
.
getvalue
(),
encodedtextwrapped
(
0
o666
,
"t1"
)
.
decode
(
"ascii"
))
def
test_decode
(
self
):
sys
.
stdin
=
io
.
String
IO
(
encodedtextwrapped
(
0
o666
,
"t1"
)
.
decode
(
"ascii"
))
sys
.
stdout
=
io
.
String
IO
()
sys
.
stdin
=
Fake
IO
(
encodedtextwrapped
(
0
o666
,
"t1"
)
.
decode
(
"ascii"
))
sys
.
stdout
=
Fake
IO
()
uu
.
decode
(
"-"
,
"-"
)
stdout
=
sys
.
stdout
sys
.
stdout
=
self
.
stdout
...
...
Lib/xml/dom/minidom.py
Dosyayı görüntüle @
794652dd
...
...
@@ -14,6 +14,7 @@ Todo:
* SAX 2 namespaces
"""
import
codecs
import
io
import
xml.dom
...
...
@@ -49,16 +50,16 @@ class Node(xml.dom.Node):
# indent = the indentation string to prepend, per level
# newl = the newline string to append
use_encoding
=
"utf-8"
if
encoding
is
None
else
encoding
writer
=
io
.
StringIO
(
encoding
=
use_encoding
)
writer
=
codecs
.
getwriter
(
use_encoding
)(
io
.
BytesIO
()
)
if
self
.
nodeType
==
Node
.
DOCUMENT_NODE
:
# Can pass encoding only to document, to put it into XML header
self
.
writexml
(
writer
,
""
,
indent
,
newl
,
encoding
)
else
:
self
.
writexml
(
writer
,
""
,
indent
,
newl
)
if
encoding
is
None
:
return
writer
.
getvalue
(
)
return
writer
.
stream
.
getvalue
()
.
decode
(
use_encoding
)
else
:
return
writer
.
buffer
.
getvalue
()
return
writer
.
stream
.
getvalue
()
def
hasChildNodes
(
self
):
if
self
.
childNodes
:
...
...
Misc/NEWS
Dosyayı görüntüle @
794652dd
...
...
@@ -78,6 +78,8 @@ Extension Modules
Library
-------
- Added C optimized implementation of io.StringIO.
- The ``pickle`` module is now automatically use an optimized C
implementation of Pickler and Unpickler when available. The
``cPickle`` module is no longer needed.
...
...
Modules/_stringio.c
0 → 100644
Dosyayı görüntüle @
794652dd
This diff is collapsed.
Click to expand it.
setup.py
Dosyayı görüntüle @
794652dd
...
...
@@ -422,6 +422,7 @@ class PyBuildExt(build_ext):
exts
.
append
(
Extension
(
"_functools"
,
[
"_functoolsmodule.c"
])
)
# Memory-based IO accelerator modules
exts
.
append
(
Extension
(
"_bytesio"
,
[
"_bytesio.c"
])
)
exts
.
append
(
Extension
(
"_stringio"
,
[
"_stringio.c"
])
)
# C-optimized pickle replacement
exts
.
append
(
Extension
(
"_pickle"
,
[
"_pickle.c"
])
)
# atexit
...
...
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