#18972: calculation blunder
--------------------------------------+--------------------
     Reporter:  amosonn@…             |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Core (Other)          |    Version:  1.4
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+--------------------
 on core/servers/basehttp.py, lines 97-103:
         if length > 33554432:
             offset = 0
             while offset < length:
                 chunk_size = min(33554432, length)
                 self._write(data[offset:offset+chunk_size])
                 self._flush()
                 offset += chunk_size
 Since only offset is increased, chunksize will always be 33554432, and on
 the last write might not be the actual amount written. Probably
 chunk_size = min(33554432, length-offset)
 is better.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18972>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to