You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/07/01 00:32:50 UTC

[spark] branch master updated: [SPARK-35938][PYTHON] Add deprecation warning for Python 3.6

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ad1261  [SPARK-35938][PYTHON] Add deprecation warning for Python 3.6
5ad1261 is described below

commit 5ad12611ec23d02b5988b92561b70dbeacf6af78
Author: Xinrong Meng <xi...@databricks.com>
AuthorDate: Thu Jul 1 09:32:25 2021 +0900

    [SPARK-35938][PYTHON] Add deprecation warning for Python 3.6
    
    ### What changes were proposed in this pull request?
    
    Add deprecation warning for Python 3.6.
    
    ### Why are the changes needed?
    
    According to https://endoflife.date/python, Python 3.6 will be EOL on 23 Dec, 2021.
    We should prepare for the deprecation of Python 3.6 support in Spark in advance.
    
    ### Does this PR introduce _any_ user-facing change?
    
    N/A.
    
    ### How was this patch tested?
    
    Manual tests.
    
    Closes #33139 from xinrong-databricks/deprecate3.6_warn.
    
    Authored-by: Xinrong Meng <xi...@databricks.com>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 python/pyspark/context.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/python/pyspark/context.py b/python/pyspark/context.py
index 6c6a538..6c94106 100644
--- a/python/pyspark/context.py
+++ b/python/pyspark/context.py
@@ -230,6 +230,14 @@ class SparkContext(object):
         self.pythonExec = os.environ.get("PYSPARK_PYTHON", 'python3')
         self.pythonVer = "%d.%d" % sys.version_info[:2]
 
+        if sys.version_info[:2] < (3, 7):
+            with warnings.catch_warnings():
+                warnings.simplefilter("once")
+                warnings.warn(
+                    "Python 3.6 support is deprecated in Spark 3.2.",
+                    FutureWarning
+                )
+
         # Broadcast's __reduce__ method stores Broadcast instances here.
         # This allows other code to determine which Broadcast instances have
         # been pickled, so it can determine which Java broadcast objects to

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org