#994911 error modifying deb822 object while iterating

Package:
python3-debian
Source:
python-debian
Submitter:
Jelmer Vernooij
Date:
2022-07-07 11:06:03 UTC
Severity:
normal
Tags:
#994911#5
Date:
2021-09-23 00:43:50 UTC
From:
To:
Modifying a deb822 file while iterating over it results in a RuntimeError:

...
  File "/home/jelmer/src/debian-janitor/python-debian/lib/debian/_deb822_repro/parsing.py", line 2208, in iter_keys
    yield from self._kvpair_elements
RuntimeError: dictionary keys changed during iteration

(This doesn't happen with the default deb822 implementation)

#994911#10
Date:
2021-10-10 06:41:55 UTC
From:
To:

Hi,

Can you provide the code snippet that triggers this bug?

As I understand it, this is "normal" for a dict depending on the exact
usage, which is why I would like to see what you were doing when you
triggered the bug. :)

Example with dict:


Thanks,
~Niels

#994911#15
Date:
2021-10-10 10:42:43 UTC
From:
To:
Thinking some more about, this *might* be fixed as a side effect of:

https://salsa.debian.org/python-debian-team/python-debian/-/merge_requests/69/diffs?commit_id=2832d2fc306b10f56ff910e6e1cf990ccdb9e9b4

(but it is hard to tell for sure without the concrete code you were using)

Feel free to cherry-pick that commit out of the branch/MR if you need it. :)

Thanks,
~Niels

#994911#20
Date:
2021-10-14 19:17:47 UTC
From:
To:
Yep, this is standard behaviour with a dict - so I wouldn't be surprised if
this was happening generally, but the default deb822 doesn't exhibit
this so it makes migrating a bit harder.

Unfortunately I've lost track of the run in the janitor that
showed this issue so we'll just have to re-enable and see
if it's fixed now.

Jelmer

#994911#25
Date:
2022-05-28 07:16:35 UTC
From:
To:
Control: tags -1 moreinfo unreproducible

Hi Jelmer,

Can you still reproduce this bug?  I suspect it might have been fixed as
a side-effect of another change already. Alternative, if you can
reproduce it, please attach the code + file that triggers the bug so I
can investigate it in detail.

Thanks,
~Niels

#994911#32
Date:
2022-07-07 11:03:18 UTC
From:
To:
This got fixed at some point. Niels speculated earlier that it was
because of https://salsa.debian.org/python-debian-team/python-debian/-/merge_requests/69/diffs?commit_id=2832d2fc306b10f56ff910e6e1cf990ccdb9e9b4