From fd5ce3877a65393e44fd5d003cf76c4392a7a73a Mon Sep 17 00:00:00 2001 From: hyukjinkwon Date: Thu, 5 Jul 2018 00:00:32 +0800 Subject: [PATCH 1/2] Make PySpark compatible with Python 3.7 --- python/pyspark/rdd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/pyspark/rdd.py b/python/pyspark/rdd.py index 7e7e5822a6b2..951851804b1d 100644 --- a/python/pyspark/rdd.py +++ b/python/pyspark/rdd.py @@ -1370,7 +1370,10 @@ def takeUpToNumLeft(iterator): iterator = iter(iterator) taken = 0 while taken < left: - yield next(iterator) + try: + yield next(iterator) + except StopIteration: + return taken += 1 p = range(partsScanned, min(partsScanned + numPartsToTry, totalParts)) From a3ff8b1e5e6fdeae5e8ba04db0383d34ecc51c45 Mon Sep 17 00:00:00 2001 From: hyukjinkwon Date: Thu, 5 Jul 2018 00:48:03 +0800 Subject: [PATCH 2/2] Don't forget to update setup.py --- python/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/setup.py b/python/setup.py index d309e0564530..45eb74eb87ce 100644 --- a/python/setup.py +++ b/python/setup.py @@ -219,6 +219,7 @@ def _supports_symlinks(): 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy'] )