Commit fe8a842
committed
Don't modify the Metadatas' hosts structure while iterating over it
On Python 3.x, dict.values() returns a view object and not a list of the
values.
Updating the content of the original dict while iterating over the
values may raise a RuntimeError exception, which is the case in the
Cluster._refresh_node_list_and_token_map() method to remove discovered
hosts which are not part of the specified cluster contact points.
The bug doesn't happen using Python 2.x as dict.values() returns a new
list containing the values of the dictionary, without any other
reference to original dictionary object.
This fix forces the original Python 2.x behavior to be the same in
Python 3.x as well.
PYTHON-5721 parent acae4c7 commit fe8a842
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
474 | 476 | | |
475 | 477 | | |
476 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
0 commit comments