mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Use cStringIO where available.
This commit is contained in:
parent
54266fce8d
commit
a617271dbd
8 changed files with 55 additions and 19 deletions
|
@ -243,8 +243,11 @@ def test():
|
|||
else:
|
||||
fp = open(fn)
|
||||
else:
|
||||
import StringIO
|
||||
fp = StringIO.StringIO(test_input)
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
fp = StringIO(test_input)
|
||||
while 1:
|
||||
line = fp.readline()
|
||||
if not line: break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue