Repository: incubator-systemml Updated Branches: refs/heads/master 305d84060 -> 60d000aa7
[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/60d000aa Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/60d000aa Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/60d000aa Branch: refs/heads/master Commit: 60d000aa794e29b2acbba76a44f9b39b5c37d0a0 Parents: 305d840 Author: Mike Dusenberry <[email protected]> Authored: Fri Jul 29 12:25:14 2016 -0700 Committer: Mike Dusenberry <[email protected]> Committed: Fri Jul 29 12:25:14 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/60d000aa/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]
