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

Yicong-Huang pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new bc025e022e2d [SPARK-58982][PYTHON] Remove unused _is_namedtuple_ 
attribute in serializers
bc025e022e2d is described below

commit bc025e022e2d626c642e241ad465c6a9ecfd3337
Author: Yicong Huang <[email protected]>
AuthorDate: Mon Nov 9 22:00:37 2026 +0000

    [SPARK-58982][PYTHON] Remove unused _is_namedtuple_ attribute in serializers
    
    ### What changes were proposed in this pull request?
    
    Remove the write-only `_is_namedtuple_` attribute set on hijacked 
namedtuple classes in `_hack_namedtuple` (`python/pyspark/serializers.py`). It 
is assigned but never read anywhere in the codebase. The 
`PYSPARK_ENABLE_NAMEDTUPLE_PATCH` monkey-patch itself is intentionally left in 
place.
    
    ### Why are the changes needed?
    
    The attribute was introduced in SPARK-10542 as a marker read by the 
then-vendored cloudpickle (`_load_namedtuple`) to special-case PySpark-hijacked 
namedtuples. That reader was dropped when cloudpickle was later upgraded, 
leaving the assignment write-only dead code.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Existing tests.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No
    
    Closes #58267 from Yicong-Huang/SPARK-58982.
    
    Authored-by: Yicong Huang <[email protected]>
    Signed-off-by: Yicong-Huang <[email protected]>
    (cherry picked from commit 3bbf07f9c6b92a4eb4c92eab431a9b0a5f111a7e)
    Signed-off-by: Yicong-Huang <[email protected]>
    
    
    skip-checks: true
---
 python/pyspark/serializers.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/python/pyspark/serializers.py b/python/pyspark/serializers.py
index 061e066f2830..20d7f5a2ee23 100644
--- a/python/pyspark/serializers.py
+++ b/python/pyspark/serializers.py
@@ -366,7 +366,6 @@ if os.environ.get("PYSPARK_ENABLE_NAMEDTUPLE_PATCH") == "1":
             return (_restore, (name, fields, tuple(self)))
 
         cls.__reduce__ = __reduce__
-        cls._is_namedtuple_ = True
         return cls
 
     def _hijack_namedtuple():


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to