Class with __iter__ = None should raise a more helpful error message
According to the Python documentation:
Setting a special method to None indicates that the corresponding operation is not available. For example, if a class sets iter() to None, the class is not iterable, so calling iter() on its instances will raise a TypeError (without falling back to getitem()). [2]
https://docs.python.org/3/reference/datamodel.html#special-method-names
PyPy follows this behavior but the TypeError it raises is not ideal:
>>>> class A:
.... __iter__ = None
....
>>>> iter(A())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
Compare this to the more helpful error raised by CPython:
>>> class A:
... __iter__ = None
...
>>> iter(A())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'A' object is not iterable
Edit: I found this while working on https://jira.mongodb.org/browse/PYTHON-3084