Skip to content

Commit 982acdf

Browse files
committed
Avoid mutate-while-iterating error under Py3k.
Addresses: googleapis#1636 (comment)
1 parent 8b0fe97 commit 982acdf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/pubsub_snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def do_something_with(message): # pylint: disable=unused-argument
378378
# [START subscription_pull_autoack]
379379
from gcloud.pubsub.subscription import AutoAck
380380
with AutoAck(subscription, max_messages=10) as ack:
381-
for ack_id, message in ack.items():
381+
for ack_id, message in list(ack.items()):
382382
try:
383383
do_something_with(message)
384384
except Exception: # pylint: disable=broad-except

0 commit comments

Comments
 (0)