viirya commented on a change in pull request #25847: [SPARK-21045][PYTHON]
Allow non-ascii string as an exception message from python execution in Python 2
URL: https://github.com/apache/spark/pull/25847#discussion_r326425526
##########
File path: python/pyspark/tests/test_worker.py
##########
@@ -150,6 +151,20 @@ def test_with_different_versions_of_python(self):
finally:
self.sc.pythonVer = version
+ def test_python_exception_non_hanging(self):
+ # SPARK-21045: exceptions with no ascii encoding shall not hanging
PySpark.
+ try:
+ def f():
+ raise Exception("exception with 中 and \xd6\xd0")
+
+ self.sc.parallelize([1]).map(lambda x: f()).count()
+ except Py4JJavaError as e:
+ if sys.version_info.major < 3:
+ # we have to use unicode here to avoid UnicodeDecodeError
+ self.assertRegexpMatches(unicode(e).encode("utf-8"),
"exception with 中")
Review comment:
Are you sure your local flake8 runs with Python3?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]