Browse Source

Upstream change in Python

The prior changes to use of return in finally (#9981) are now
insufficient. Without disclosing their intent when raising the issue,
this was used by them as part of justifying a SyntaxError for working
code outside of the normal process for adding errors, and with it
presenting to end users in a way that breaks downstream user's existing CI

While making the change, I've continued to not log errors like
CancellationError or TimeoutError to users here by default, as it is not an error
they need to be aware of during shutdown given the limited kinds of
BaseException that could raise in this context, see: #9984 for prior
analysis. I've added a debug log should anyone want access to this kind
of failure while debugging gateway close, but due to how asyncio
shutdown happens, this is unlikely to ever log anything useful even in a
library debugging context.
pull/10262/head
Michael H 5 days ago
committed by GitHub
parent
commit
439bd71c0d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      discord/gateway.py

4
discord/gateway.py

@ -160,9 +160,11 @@ class KeepAliveHandler(threading.Thread):
f.result() f.result()
except Exception: except Exception:
_log.exception('An error occurred while stopping the gateway. Ignoring.') _log.exception('An error occurred while stopping the gateway. Ignoring.')
except BaseException as exc:
_log.debug('A BaseException was raised while stopping the gateway', exc_info=exc)
finally: finally:
self.stop() self.stop()
return return
data = self.get_payload() data = self.get_payload()
_log.debug(self.msg, self.shard_id, data['d']) _log.debug(self.msg, self.shard_id, data['d'])

Loading…
Cancel
Save