Open StephanOLC opened 1 year ago
What if the calling function is the top-level one? Wouldn't that also satisfy the condition that there is no previous frame?
Could you try adding a unit test that fails without the fix and succeeds with it?
If the top level function is the caller it should be caught by the if clause before.
if filename == file_name and f.f_lineno == lineno and co.co_name == func_name: break
The logic i changed affects going up the stack if the current frame is not the correct one.
if f.f_back: f = f.f_back else: # Reached the last stack frame and found no matching one. raise ValueError("Could not find function [%s] on the framestack"%func_name)
A unit test could certainly be written to test it.
Raising an ValueError if the caller function can not be found inside RospyLogger::findCaller() instead of looping indefinitly. Fixes #2352 partially. It prevents the function from looping indefinitely, but the correct frame is still not found.