Scrapy, a fast high-level web crawling & scraping framework for Python.
HTTP/2 stream close reason handling: Use else + assert instead of elif
Adrián Chaves5ba31cd1a268
diff --git a/scrapy/core/http2/stream.py b/scrapy/core/http2/stream.pyindex 8a1b3e470..aa44c08ce 100644--- a/scrapy/core/http2/stream.py+++ b/scrapy/core/http2/stream.py@@ -431,7 +431,8 @@ class Stream:errors.insert(0, InactiveStreamClosed(self._request))self._deferred_response.errback(ResponseFailed(errors))- elif reason is StreamCloseReason.INVALID_HOSTNAME:+ else:+ assert reason is StreamCloseReason.INVALID_HOSTNAMEself._deferred_response.errback(InvalidHostname(self._request,str(self._protocol.metadata['uri'].host, 'utf-8'),