safety import fix: 'io' isn't a very unique module name
authorStefan Behnel <scoder@users.berlios.de>
Fri, 16 Apr 2010 07:04:57 +0000 (09:04 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 16 Apr 2010 07:04:57 +0000 (09:04 +0200)
Cython/Utils.py

index 91b8cf49f7850ec52e4449c07172d545af3dea4f..48877c7b212811d508b12a6a4d163be10be82330 100644 (file)
@@ -130,10 +130,12 @@ class NormalisedNewlineStream(object):
         data = self._read(0x1000)
     return u''.join(content).split(u'\n')
 
-try:
-    import io
-except ImportError:
-    io = None
+io = None
+if sys.version_info >= (2,6):
+    try:
+        import io
+    except ImportError:
+        pass
 
 def open_source_file(source_filename, mode="r",
                      encoding=None, error_handling=None,