gh-112997: Don't log arguments in asyncio unless debugging (#115667)

Nothing else in Python generally logs the contents of variables, so this
can be very unexpected for developers and could leak sensitive
information in to terminals and log files.
This commit is contained in:
Pierre Ossman (ThinLinc team) 2024-02-28 02:39:08 +01:00 committed by GitHub
parent a355f60b03
commit 5a1559d949
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 12 deletions

View file

@ -54,7 +54,8 @@ class Handle:
info.append('cancelled')
if self._callback is not None:
info.append(format_helpers._format_callback_source(
self._callback, self._args))
self._callback, self._args,
debug=self._loop.get_debug()))
if self._source_traceback:
frame = self._source_traceback[-1]
info.append(f'created at {frame[0]}:{frame[1]}')
@ -90,7 +91,8 @@ class Handle:
raise
except BaseException as exc:
cb = format_helpers._format_callback_source(
self._callback, self._args)
self._callback, self._args,
debug=self._loop.get_debug())
msg = f'Exception in callback {cb}'
context = {
'message': msg,