beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [beam] branch master updated: Catch __module__ is None.
Date Thu, 02 Jan 2020 23:35:14 GMT
This is an automated email from the ASF dual-hosted git repository.

tvalentyn pushed a commit to branch master
in repository

The following commit(s) were added to refs/heads/master by this push:
     new 0ac760a  Catch __module__ is None.
     new ad7f6e1  Merge pull request #10475 from rainwoodman/patch-1
0ac760a is described below

commit 0ac760ae5b7ae874d00c0c39d973563be02775c5
Author: Yu Feng <>
AuthorDate: Fri Dec 27 15:18:43 2019 -0800

    Catch __module__ is None.
    The current code crashes when __module__ is None.
    According to
    __module__ is  "The name of the module the function was defined in, or None if unavailable."
    As a very particular example, Protobuf sets generated type's __module__ to None:
 sdks/python/apache_beam/internal/ | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sdks/python/apache_beam/internal/ b/sdks/python/apache_beam/internal/
index 3cca9d3..0296840 100644
--- a/sdks/python/apache_beam/internal/
+++ b/sdks/python/apache_beam/internal/
@@ -75,6 +75,7 @@ if not getattr(dill, '_dill', None):
 def _is_nested_class(cls):
   """Returns true if argument is a class object that appears to be nested."""
   return (isinstance(cls, type)
+          and cls.__module__ is not None
           and cls.__module__ != 'builtins'     # Python 3
           and cls.__module__ != '__builtin__'  # Python 2
           and cls.__name__ not in sys.modules[cls.__module__].__dict__)

View raw message