steemit / steem-python

The official Python (3) library for the Steem Blockchain.
https://steem.io
MIT License
153 stars 99 forks source link

Non-recursive failure handling in HttpClient.exec() #95

Closed theoreticalbts closed 6 years ago

theoreticalbts commented 6 years ago

This PR fixes a bug where occasionally steem-python will revert to positional argument passing when RPC methods are called with keyword arguments. The bug occurs when retrying after a failure of the server RPC connection. The existing implementation has a recursive tail call to exec but PR #86 did not update the tail call to forward the new kwargs argument.

This patch refactors the recursive tail call to use a loop instead, which has the following desirable properties:

Adding ?w=1 to the URL to suppress whitespace will make this pull request easier to review, this patch is like a textbook example of replacing recursion with iteration.

roadscape commented 6 years ago

Thanks for the ?w=1 tip, that's incredibly useful. Closing this PR; your change will be implemented in #202.