diff --git a/python/pyspark/rdd.py b/python/pyspark/rdd.py index 8dc30a42f74e0..eadb5aba89a03 100644 --- a/python/pyspark/rdd.py +++ b/python/pyspark/rdd.py @@ -1368,7 +1368,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)) diff --git a/python/setup.py b/python/setup.py index 80cf0d7b329bd..e599fe607d63f 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'] )