Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

add lines to prevent dict from mutating while being iterated over #791

Merged
merged 3 commits into from
Sep 5, 2018

Conversation

TheseusGrey
Copy link
Contributor

@TheseusGrey TheseusGrey commented Sep 5, 2018

created a copy of the dictionary to be used instead of original when iterating, this way if the dictionary mutates it won't affect the iterator.
fix: #762


This change is Reviewable

Copy link
Contributor

@NiallEgan NiallEgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @dent50cent)


aimmo-game/service.py, line 108 at r1 (raw file):

            return logs is not None and logs != ''

        socket_session_id_to_player_id_copy = self._socket_session_id_to_player_id

I think you actually need to copy it, this just creates another reference to the same object

Copy link
Contributor

@NiallEgan NiallEgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, 1 of 1 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@TheseusGrey TheseusGrey merged commit d0ce10e into master Sep 5, 2018
@TheseusGrey TheseusGrey deleted the sid_to_avatarID_mutation branch September 5, 2018 14:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants