Assigning to repeated field does not work
What version of protobuf and what language are you using? Version: main/v4.25.2 Language: Python
What operating system (Linux, Windows, ...) and version?
Arch Linux
What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.11.6
What did you do?
roof = [f for f in doc.faces if f.type == Face.Type.ROOF]
# doc.ClearField('faces')
# doc.faces.extend(roof)
doc.faces[:] = roof
What did you expect to see Success, no errors
What did you see instead?
File "/home/skrat/Workspace/xxx/rwdom/backend/projects/management/commands/import.py", line 65, in handle
doc.faces[:] = roof
~~~~~~~~~^^^
File "/home/skrat/Workspace/xxx/rwdom/backend/.venv/lib/python3.11/site-packages/google/protobuf/internal/containers.py", line 348, in __setitem__
raise TypeError(
TypeError: RepeatedCompositeFieldContainer object does not support item assignment
I know this is said in the lang. guide, but why tho? What's preventing you from making this work? Why can't we assign to repeated message fields?
@anandolee Can you answer why assignment syntax doesn't work for repeated fields?
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.
I'll take a look at this myself, later.
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 issue will be closed and archived after 14 additional days without activity.