@@ -105,7 +105,7 @@ def get_object_by_address(address, root=None, namespace={}):
105105 root = get_object_by_address (root )
106106 root_short_name = root .__name__ .rsplit ('.' , 1 )[- 1 ]
107107
108- if namespace :
108+ if namespace not in ( None , {}) :
109109 # And then for `namespace`:
110110 if isinstance (namespace , str ):
111111 namespace = get_object_by_address (namespace )
@@ -136,8 +136,8 @@ def get_object_by_address(address, root=None, namespace={}):
136136 if root and (address == root_short_name ):
137137 return root
138138
139- if parent_object :
140-
139+ if parent_object is not None :
140+
141141 if isinstance (parent_object , types .ModuleType ) and \
142142 hasattr (parent_object , '__path__' ):
143143
@@ -166,7 +166,7 @@ def get_object_by_address(address, root=None, namespace={}):
166166 # `parent_object`. We try this before `namespace_dict` because
167167 # `parent_object` may have `__getattr__` or similar magic and our
168168 # object might be found through that:
169- if parent_object and hasattr (parent_object , address ):
169+ if ( parent_object is not None ) and hasattr (parent_object , address ):
170170 return getattr (parent_object , address )
171171
172172 # Next is the `namespace_dict`:
0 commit comments