summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2017-09-07 11:08:01 -0500
committerJason Madden <jamadden@gmail.com>2017-09-07 11:08:01 -0500
commitc154bb046668f9307286922ca1a025088f396792 (patch)
treed387af38744b19520bbba1531d7f6cb054829a05
parent04db7bea21589a3a7edb29863984e08af2c75c0a (diff)
downloadzope-security-c154bb046668f9307286922ca1a025088f396792.tar.gz
Fix issue with __length_hint__ in pure Python 3. This is picked out of #29
-rw-r--r--src/zope/security/proxy.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/zope/security/proxy.py b/src/zope/security/proxy.py
index 77a82d4..302257a 100644
--- a/src/zope/security/proxy.py
+++ b/src/zope/security/proxy.py
@@ -202,7 +202,12 @@ class ProxyPy(PyProxyBase):
def __length_hint__(self):
# no check
wrapped = super(PyProxyBase, self).__getattribute__('_wrapped')
- return wrapped.__length_hint__()
+ try:
+ hint = wrapped.__length_hint__
+ except AttributeError:
+ return NotImplemented
+ else:
+ return hint()
def __coerce__(self, other):
# For some reason _check_name does not work for coerce()