You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by ha...@apache.org on 2010/06/04 23:49:58 UTC
svn commit: r951585 - /avro/trunk/lang/py/src/avro/datafile.py
Author: hammer
Date: Fri Jun 4 21:49:58 2010
New Revision: 951585
URL: http://svn.apache.org/viewvc?rev=951585&view=rev
Log:
Part 3 of AVRO-526: Fall back to pure Python StringIO if cStringIO is not
available. Missed datafile.py. (hammer)
Modified:
avro/trunk/lang/py/src/avro/datafile.py
Modified: avro/trunk/lang/py/src/avro/datafile.py
URL: http://svn.apache.org/viewvc/avro/trunk/lang/py/src/avro/datafile.py?rev=951585&r1=951584&r2=951585&view=diff
==============================================================================
--- avro/trunk/lang/py/src/avro/datafile.py (original)
+++ avro/trunk/lang/py/src/avro/datafile.py Fri Jun 4 21:49:58 2010
@@ -18,7 +18,10 @@ Read/Write Avro File Object Containers.
"""
import zlib
import uuid
-import cStringIO
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
from avro import schema
from avro import io
@@ -74,7 +77,7 @@ class DataFileWriter(object):
self._writer = writer
self._encoder = io.BinaryEncoder(writer)
self._datum_writer = datum_writer
- self._buffer_writer = cStringIO.StringIO()
+ self._buffer_writer = StringIO()
self._buffer_encoder = io.BinaryEncoder(self._buffer_writer)
self._block_count = 0
self._meta = {}
@@ -285,7 +288,7 @@ class DataFileReader(object):
# -15 is the log of the window size; negative indicates
# "raw" (no zlib headers) decompression. See zlib.h.
uncompressed = zlib.decompress(data, -15)
- self._datum_decoder = io.BinaryDecoder(cStringIO.StringIO(uncompressed))
+ self._datum_decoder = io.BinaryDecoder(StringIO(uncompressed))
def _skip_sync(self):
"""