Skip to content

Commit d1f49ce

Browse files
trollfot1st1
authored andcommitted
Removed meaningless code from the should_upgrade test.
1 parent a3dbe51 commit d1f49ce

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

httptools/parser/parser.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ cdef class HttpParser:
152152
return bool(cparser.http_should_keep_alive(self._cparser))
153153

154154
def should_upgrade(self):
155-
return bool(self._cparser.upgrade)
155+
cdef cparser.http_parser* parser = self._cparser
156+
return bool(parser.upgrade)
156157

157158
def feed_data(self, data):
158159
cdef:

tests/test_parser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,12 @@ def on_message_complete(self):
367367
protocol = Protocol()
368368
try:
369369
protocol.parser.feed_data(UPGRADE_REQUEST1)
370-
except httptools.HttpParserUpgrade as ex:
371-
offset = ex.args[0]
370+
except httptools.HttpParserUpgrade:
371+
# Raise as usual.
372+
pass
372373
else:
373374
self.fail('HttpParserUpgrade was not raised')
374-
375+
375376
def test_parser_request_error_in_on_header(self):
376377
class Error(Exception):
377378
pass

0 commit comments

Comments
 (0)