Fix the weird py__path__ behavior

This commit is contained in:
Dave Halter committed 2019-08-21 23:08:42 +02:00
1 parent 592f3771fc
commit 2fb04db0ab
7 files changed
+49 -54

No files matched your search

+7 -1
View File
@@ -273,7 +273,13 @@ class DirectObjectAccess(object):
return [self._create_access_path(base) for base in self._obj.__bases__]
def py__path__(self):
return self._obj.__path__
paths = getattr(self._obj, '__path__', None)
# Avoid some weird hacks that would just fail, because they cannot be
# used by pickle.
if not isinstance(paths, list) \
or not all(isinstance(p, (bytes, unicode)) for p in paths):
return None
return paths
@_force_unicode_decorator
def get_repr(self):