You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/03 21:16:01 UTC

[GitHub] [beam] kennknowles opened a new issue, #18934: Pickler enters infinite recursion with self-referential classes

kennknowles opened a new issue, #18934:
URL: https://github.com/apache/beam/issues/18934

   The pickler recurses infinitely and dies with maximum recursion limit exceeded when a module contains a self-referential class (or any class which is part of a cycle).
   
   Here's a minimal example: 
   ```
   
   class RecursiveClass(object):
    SELF_TYPE = None
   
    def __init__(self, datum)
      self.datum = 'RecursiveClass:%s'
   % datum
   
   RecursiveClass.SELF_TYPE = RecursiveClass
   
   ```
   
   If this is in a module, then the pickler will enter the infinite recursion when trying to pickle any nested class in that module.
     
   
   An actual example is with typing.Type, which is part of a cycle typing.Type -\> type -\> object -\> typing.Type. If a module contains an attribute that refers to typing.Type, such as a type alias, it will trigger this bug.
   
   Imported from Jira [BEAM-4036](https://issues.apache.org/jira/browse/BEAM-4036). Original Jira may contain additional context.
   Reported by: chuanyu.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org