Skip to content

Commit 1f1acc3

Browse files
authored
prevented editing iterator during iteration
1 parent a166557 commit 1f1acc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/selenium/webdriver/common/bidi/network.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def _remove_intercept(self, intercept=None):
111111
If intercept is None, all intercepts will be removed.
112112
"""
113113
if intercept is None:
114-
for intercept_id in self.intercepts: # remove all intercepts
114+
intercepts_to_remove = self.intercepts.copy() # create a copy before iterating
115+
for intercept_id in intercepts_to_remove: # remove all intercepts
115116
self.conn.execute(self.command_builder("network.removeIntercept", {"intercept": intercept_id}))
116117
self.intercepts.remove(intercept_id)
117118
else:

0 commit comments

Comments
 (0)