Skip to content

Commit

Permalink
Tightened up assertions. All tests still pass on 2.x/3.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip committed Jan 2, 2017
1 parent baf3dc1 commit 9935e6f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion supervisor/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ def refill_buffer (self):
self.producer_fifo.pop()
self.close()
return
elif isinstance(p, str):
else:
assert isinstance(p, bytes)
self.producer_fifo.pop()
self.ac_out_buffer += p
return
Expand Down
4 changes: 3 additions & 1 deletion supervisor/medusa/asynchat_25.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ def refill_buffer (self):
self.producer_fifo.pop()
self.close()
return
elif isinstance(p, str):
else:
assert isinstance(p, bytes)
self.producer_fifo.pop()
self.ac_out_buffer += p
return

data = p.more()
if data:
self.ac_out_buffer = self.ac_out_buffer + data
Expand Down
8 changes: 3 additions & 5 deletions supervisor/medusa/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,9 @@ def found_terminator (self):
)

def push (self, thing):
if type(thing) == type(''):
self.outgoing.append(producers.simple_producer(thing,
buffer_size=len(thing)))
else:
self.outgoing.append(thing)
assert isinstance(thing, bytes)
thing = producers.simple_producer(thing, buffer_size=len(thing))
self.outgoing.append(thing)

def response (self, code=200):
message = self.responses[code]
Expand Down

0 comments on commit 9935e6f

Please sign in to comment.