Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'dictproxy' object has no attribute 'viewitems', 'viewvalues', 'viewkeys' #295

Open
graingert opened this issue Aug 6, 2019 · 2 comments

Comments

@graingert
Copy link
Contributor

Python 2.7.16 (default, Apr  6 2019, 01:42:57) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Ham(object):
...     pass
... 
>>> import six
>>> six.viewitems(vars(Ham))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dictproxy' object has no attribute 'viewitems'
>>> six.viewvalues(vars(Ham))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dictproxy' object has no attribute 'viewvalues'
>>> six.viewkeys(vars(Ham))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dictproxy' object has no attribute 'viewkeys'

strictly speaking this might be a cPython bug, but I think the six methods need to include a check for dictproxy and handle this case

@graingert
Copy link
Contributor Author

python/cpython#15143

@graingert
Copy link
Contributor Author

CPython will not be fixing this, so we need a workaround.

python/cpython#15143 (comment)

graingert added a commit to graingert/six that referenced this issue Aug 12, 2019
graingert added a commit to graingert/six that referenced this issue Nov 14, 2019
graingert added a commit to graingert/six that referenced this issue Nov 14, 2019
graingert added a commit to graingert/six that referenced this issue Nov 14, 2019
graingert added a commit to graingert/six that referenced this issue Nov 14, 2019
graingert added a commit to graingert/six that referenced this issue Nov 14, 2019
graingert added a commit to graingert/six that referenced this issue Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant