spark git commit: [SPARK-12268][PYSPARK] Make pyspark shell pythonstartup work under python3
Repository: spark Updated Branches: refs/heads/master 97e0c7c5a -> e4e0b3f7b [SPARK-12268][PYSPARK] Make pyspark shell pythonstartup work under python3 This replaces the `execfile` used for running custom python shell scripts with explicit open, compile and exec (as recommended by 2to3). The reason for this change is to make the pythonstartup option compatible with python3. Author: Erik Selin Closes #10255 from tyro89/pythonstartup-python3. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e4e0b3f7 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e4e0b3f7 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e4e0b3f7 Branch: refs/heads/master Commit: e4e0b3f7b2945aae5ec7c3d68296010bbc5160cf Parents: 97e0c7c Author: Erik Selin Authored: Wed Jan 13 12:21:45 2016 -0800 Committer: Josh Rosen Committed: Wed Jan 13 12:21:45 2016 -0800 -- python/pyspark/shell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/spark/blob/e4e0b3f7/python/pyspark/shell.py -- diff --git a/python/pyspark/shell.py b/python/pyspark/shell.py index 9933129..26cafca 100644 --- a/python/pyspark/shell.py +++ b/python/pyspark/shell.py @@ -76,4 +76,6 @@ if add_files is not None: # which allows us to execute the user's PYTHONSTARTUP file: _pythonstartup = os.environ.get('OLD_PYTHONSTARTUP') if _pythonstartup and os.path.isfile(_pythonstartup): -execfile(_pythonstartup) +with open(_pythonstartup) as f: +code = compile(f.read(), _pythonstartup, 'exec') +exec(code) - To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org
spark git commit: [SPARK-12268][PYSPARK] Make pyspark shell pythonstartup work under python3
Repository: spark Updated Branches: refs/heads/branch-1.6 364f799cf -> cf6d506c7 [SPARK-12268][PYSPARK] Make pyspark shell pythonstartup work under python3 This replaces the `execfile` used for running custom python shell scripts with explicit open, compile and exec (as recommended by 2to3). The reason for this change is to make the pythonstartup option compatible with python3. Author: Erik Selin Closes #10255 from tyro89/pythonstartup-python3. (cherry picked from commit e4e0b3f7b2945aae5ec7c3d68296010bbc5160cf) Signed-off-by: Josh Rosen Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/cf6d506c Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/cf6d506c Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/cf6d506c Branch: refs/heads/branch-1.6 Commit: cf6d506c7426dbcd19d4c9d7c2d673aa52d00d4e Parents: 364f799 Author: Erik Selin Authored: Wed Jan 13 12:21:45 2016 -0800 Committer: Josh Rosen Committed: Wed Jan 13 12:22:21 2016 -0800 -- python/pyspark/shell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/spark/blob/cf6d506c/python/pyspark/shell.py -- diff --git a/python/pyspark/shell.py b/python/pyspark/shell.py index 9933129..26cafca 100644 --- a/python/pyspark/shell.py +++ b/python/pyspark/shell.py @@ -76,4 +76,6 @@ if add_files is not None: # which allows us to execute the user's PYTHONSTARTUP file: _pythonstartup = os.environ.get('OLD_PYTHONSTARTUP') if _pythonstartup and os.path.isfile(_pythonstartup): -execfile(_pythonstartup) +with open(_pythonstartup) as f: +code = compile(f.read(), _pythonstartup, 'exec') +exec(code) - To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org