protobuf
protobuf copied to clipboard
Implement __iter__ in Python RepeatedScalarContainer
What language does this apply to? Python
Describe the problem you are trying to solve.
The __iter__
attribute is commonly used to check whether an object is list-like, so neglecting to include it can cause issues, for example this bug in pandas: pandas-dev/pandas#42549. This results in weird behavior where list(obj)
works fine even though hasattr(obj, '__iter__')
is False.
Describe the solution you'd like
The Python RepeatedScalarContainer
should implement tp_iter
in addition to tp_as_sequence
.
Describe alternatives you've considered
Manually convert to a list every time we use RepeatedScalarContainer (list(obj)
).
@zhangskz Are there any updates on this?
Ping on this.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
This is still a problem, and internally at Google we still have to patch Pandas in order to make it work with proto repeated fields. Any updates as to fixing this?
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive
label was added.