You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
report() raises AttributeError for a non-string name, breaking the never-raises promise #2
TraceClient.report() promises it never raises, but a non-string name escapes the try block.
In trace_client/trace_client.py, report() evaluates not name or not name.strip() on the line before its try. Passing a truthy value that is not a str, for example report(123), raises AttributeError: 'int' object has no attribute 'strip' straight into the host program. Reproduced on Python 3.8.10:
>>> c = TraceClient("http://127.0.0.1:1", "app", key="k")
>>> c.report(123)
AttributeError: 'int' object has no attribute 'strip'
The class docstring and the README's "What report promises" table both say report never raises. The type hint says str, but annotations are not enforced, and this is exactly the case the promise exists for.
Suggested fix: run the blank-name check inside the existing try, so a bad name gets dropped and logged at DEBUG the same way any other unqueueable report is.
Activity