aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/pyspark/tests.py')
-rw-r--r--python/pyspark/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/pyspark/tests.py b/python/pyspark/tests.py
index 4483bf80db..d1bb2033b7 100644
--- a/python/pyspark/tests.py
+++ b/python/pyspark/tests.py
@@ -213,6 +213,24 @@ class SerializationTestCase(unittest.TestCase):
out2 = ser.loads(ser.dumps(out1))
self.assertEquals(out1, out2)
+ def test_func_globals(self):
+
+ class Unpicklable(object):
+ def __reduce__(self):
+ raise Exception("not picklable")
+
+ global exit
+ exit = Unpicklable()
+
+ ser = CloudPickleSerializer()
+ self.assertRaises(Exception, lambda: ser.dumps(exit))
+
+ def foo():
+ sys.exit(0)
+
+ self.assertTrue("exit" in foo.func_code.co_names)
+ ser.dumps(foo)
+
class PySparkTestCase(unittest.TestCase):