pygdbmi
pygdbmi copied to clipboard
Add return_on_result flag, to return immediately when a result is received
- [x] I have added an entry to
CHANGELOG.md
Summary of changes
When I run a command and wait for the response, many times I don't want to wait for the entire timeout. So I added a flag return_on_result, which returns immediately when a response of type 'result' is received.
Notes:
- I made this False by default to preserve backwards compatibility.
- I added this flag to
IoManager.write()as well, together withtimeout_secandraise_error_on_timeoutwhich are also passed toget_gdb_response(). I added it afterraise_error_on_timeoutand beforeread_response, to keep it with the otherget_gdb_response()flags. However, this will break code that setsread_responseas a positional argument (meaning:iomanager.write('-cmd', timeout, raise_error_on_timeout, read_response). I leave it up to you to decide if you prefer better backwards compatibility or a more logical ordering of arguments. - The first two commits were just to make nox happy. The second commit might actually have some significance - it seems that .pyc files not in the root directory could be included in sdists.
Test plan
I added an automated test which sets the return_on_result flag and makes sure it returns fast. You can see it fail by replacing True with False in test_gdbcontroller.py:
responses = gdbmi.write(["-rubbish"], return_on_result=True)