~ubuntuone-hackers/kombu/trunk

Viewing all changes in revision 1831.

  • Committer: Omer Katz
  • Author(s): Gabriel Amram
  • Date: 2017-07-10 18:21:49 UTC
  • Revision ID: git-v1:b2f21289284496efd89acea003ff9c24105b970e
Fix infinite loop in create_loop (#760)

* Fix infinite loop in create_loop

fixes https://github.com/celery/celery/issues/3712 

Before handling the todo items we "freeze" them by copying them aside and clearing the list.
This way if an item in the todo list appends a new callable to the list itself it will be taken care of in the next iteration of the parent loop instead of producing an infinite loop by adding it to the list we're running on.

* Changed the test to be aligned with the new implementation

* passing flake8

* Avoid copying results with each iteration of the async loop.

* Pop instead of slicing.

* fixed: todos -> todo, fixed test to use MagicMock so we can use the len() method

* MagicMock not supported in 2.7, implemented __len__ on Mock instead

* added entry to changelog

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: