bibanon / BASC-py4chan

Python wrapper for 4chan API. The BA's vastly improved fork of Edgeworth's original.
http://basc-py4chan.readthedocs.org/en/latest/index.html
Do What The F*ck You Want To Public License
55 stars 13 forks source link

Prevent RuntimeError when refreshing the board cache #9

Closed irlittz closed 9 years ago

irlittz commented 9 years ago

By wrapping the dict values in a tuple and iterating over it instead, a copy of the references contained within is made, and is thus unaffected by the underlying dictionary changing size during runtime.

Calling a thread's update method may lead to the thread modifying the board's cache during the iteration, leading to the described RuntimeError.

DanielOaks commented 9 years ago

Cool, looks good. Thanks for catching it, I'll try to push out a new version in the next few days with this fix.