Open vikramsubramanian opened 3 months ago
showwarning
function being patched.showwarning
function might not be capturing the correct stack frame when logging the warning.showwarning
function in the codebase (likely in a logging.py
module or similar) and ensure it captures the correct stack frame to report the accurate source location of the warning.showwarning
function is not found in the provided snippets, it is likely defined elsewhere in the codebase. Search the entire codebase for the definition and patching of showwarning
.showwarning
function to use the stacklevel
parameter or inspect the stack manually to find the original call site of the warning and log it correctly.filename
and lineno
parameters passed to the logging system within showwarning
reflect the original call site, not the location of the showwarning
function itself.
When logging the path from which the warning message occurred, it will show the exact location of where you patched
showwarning
instead of where the warning message was actually called from.For example, the first and last warnings are coming from PyTorch Lightning, but here it says that they come from my
logging.py
module, where I did what's described in the link above.<img width="1100" alt="image" src="
Is there any viable solution to this? Thanks!
)