Repository: incubator-systemml
Updated Branches:
  refs/heads/branch-0.10 c85ebed6b -> 944c0445f


[SYSTEMML-830] Python API Broken In Python 3 Due To Changes In Dictionary 
Iteration

Currently, the executeScript(...) function in the Python API
(SystemML.py) has a bug in Python 3 due to changes from Python 2 -> 3
dealing with iteration over a dictionary. dictName.items() returned a
list of the current items in the dictionary in Python 2, while it
returns a live iterable in Python 3. The consequence is that a
dictionary cannot be modified in a loop using dictName.items() in Python
3. This fix will simply force the iterable to a list in either Python
version, as discussed in PEP 0469. We simply use this in the existing API for
lightweight argument parsing, so performance is not a concern.


Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/944c0445
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/944c0445
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/944c0445

Branch: refs/heads/branch-0.10
Commit: 944c0445f87809cedf52f10c8712f9f716eee41f
Parents: c85ebed
Author: Mike Dusenberry <[email protected]>
Authored: Fri Jul 29 12:25:14 2016 -0700
Committer: Mike Dusenberry <[email protected]>
Committed: Fri Jul 29 12:36:06 2016 -0700

----------------------------------------------------------------------
 src/main/java/org/apache/sysml/api/python/SystemML.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/944c0445/src/main/java/org/apache/sysml/api/python/SystemML.py
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/api/python/SystemML.py 
b/src/main/java/org/apache/sysml/api/python/SystemML.py
index 5c656ab..8ad3117 100644
--- a/src/main/java/org/apache/sysml/api/python/SystemML.py
+++ b/src/main/java/org/apache/sysml/api/python/SystemML.py
@@ -110,7 +110,7 @@ class MLContext(object):
         try:
             # Register inputs as needed
             if nargs is not None:
-                for key, value in nargs.items():
+                for key, value in list(nargs.items()):
                     if isinstance(value, DataFrame):
                         self.registerInput(key, value)
                         del nargs[key]

Reply via email to