[Numpy-svn] r8211 - trunk/numpy/oldnumeric

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 20:49:39 CST 2010


Author: ptvirtan
Date: 2010-02-20 20:49:39 -0600 (Sat, 20 Feb 2010)
New Revision: 8211

Modified:
   trunk/numpy/oldnumeric/compat.py
   trunk/numpy/oldnumeric/misc.py
Log:
3K: ENH: make oldnumeric to import -- but don't implement oldnumeric.Unpickler as it's not straightforward to do

Modified: trunk/numpy/oldnumeric/compat.py
===================================================================
--- trunk/numpy/oldnumeric/compat.py	2010-02-21 02:49:22 UTC (rev 8210)
+++ trunk/numpy/oldnumeric/compat.py	2010-02-21 02:49:39 UTC (rev 8211)
@@ -95,12 +95,20 @@
         return m
 
 import pickle, copy
-class Unpickler(pickle.Unpickler):
-    def load_array(self):
-        self.stack.append(_LoadArray(self))
+if sys.version_info[0] >= 3:
+    class Unpickler(pickle.Unpickler):
+        # XXX: should we implement this? It's not completely straightforward
+        #      to do.
+        def __init__(self, *a, **kw):
+            raise NotImplementedError(
+                "numpy.oldnumeric.Unpickler is not supported on Python 3")
+else:
+    class Unpickler(pickle.Unpickler):
+        def load_array(self):
+            self.stack.append(_LoadArray(self))
 
-    dispatch = copy.copy(pickle.Unpickler.dispatch)
-    dispatch['A'] = load_array
+        dispatch = copy.copy(pickle.Unpickler.dispatch)
+        dispatch['A'] = load_array
 
 class Pickler(pickle.Pickler):
     def __init__(self, *args, **kwds):

Modified: trunk/numpy/oldnumeric/misc.py
===================================================================
--- trunk/numpy/oldnumeric/misc.py	2010-02-21 02:49:22 UTC (rev 8210)
+++ trunk/numpy/oldnumeric/misc.py	2010-02-21 02:49:39 UTC (rev 8211)
@@ -18,6 +18,13 @@
 import copy
 import copy_reg
 
+import sys
+if sys.version_info[0] >= 3:
+    import copyreg
+    import io
+    StringIO = io.BytesIO
+    copy_reg = copyreg
+
 from numpy import sort, clip, rank, sign, shape, putmask, allclose, size,\
      choose, swapaxes, array_str, array_repr, e, pi, put, \
      resize, around, concatenate, vdot, transpose, \



More information about the Numpy-svn mailing list