Github user e-dorigatti commented on a diff in the pull request: https://github.com/apache/spark/pull/21383#discussion_r189890760 --- Diff: python/pyspark/shuffle.py --- @@ -67,6 +67,19 @@ def get_used_memory(): return 0 +def safe_iter(f): + """ wraps f to make it safe (= does not lead to data loss) to use inside a for loop + make StopIteration's raised inside f explicit + """ + def wrapper(*args, **kwargs): + try: + return f(*args, **kwargs) + except StopIteration as exc: + raise RuntimeError('StopIteration in client code', exc) --- End diff -- I wanted to be explicit and let the user know it's their problem. Can you suggest a better message?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org